ios - How to display content to cell using textLabel.text to a TableView object in Swift -
i want add simple string textlabel.text property display in cells in example.
i added number of sections, number of rows in section, , trying display data cells.
import uikit class viewcontroller: uiviewcontroller, uitableviewdatasource { // number of sections in table view func numberofsectionsintableview(tableview: uitableview) -> int { return 1 } // number of rows in section func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { return 5 } // returns content of each row func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { // object represent each cell var cell = uitableviewcell() // configure cell.textlabel?.text? = "hello" - run problem //cell.textlabel?.text = "hello" - run problem return cell }
the viewcontroller not configured delegate.
Comments
Post a Comment