ios - Swift: How to use static cell in dynamic UITableView -
static dynamic dynamic dynamic .. .. dynamic
i've dynamic table list dynamic content. @ top of list, need static cell.
and trying add label in static cell try features.
my static cell's identifier is: firstcell
dynamic cell's identifier is: cell
override func numberofsectionsintableview(tableview: uitableview) -> int { // #warning potentially incomplete method implementation. // return number of sections. return 1 } override func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { // #warning incomplete method implementation. // return number of rows in section. return 5 } override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("cell", forindexpath: indexpath) as! uitableviewcell // configure cell... cell.textlabel?.text = "test" return cell }
this code return 5 times "test" in dynamic cells. when try add label , create outlet static cell, error.
i've googled , searched on stackoverflow there no swift version solution. how can that?
edit improve question:
actually need 2 section , section1 static content (i create programatically. e.g use uidatepicker, uipicker , more..), section2 work dynamic array (this part okey)
have tried this?
override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("cell", forindexpath: indexpath) as! uitableviewcell if (indexpath.row == 1) { cell.textlabel?.text = "test" } else { // configure cell... } return cell }
Comments
Post a Comment