static
dynamic
dynamic
dynamic
..
..
dynamic
I've a dynamic table list with dynamic content. At the top of list, I need a static cell.
And trying to add a Label in my static cell to 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 the number of sections.
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete method implementation.
// Return the number of rows in the section.
return 5
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! UITableViewCell
// Configure the cell...
cell.textLabel?.text = "test"
return cell
}
This code return 5 times "test" in my dynamic cells. When I am try to add a Label and create outlet with static cell, get error.
I've googled and searched on stackoverflow but there is no swift version solution. How can do that?
EDIT FOR IMPROVE TO QUESTION:
Actually I need two section and section1 will be static content (I will create it programatically. E.g will use uidatepicker, uipicker and more..), section2 will work with just an dynamic array (this part is okey)
Have you tried something like 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 the cell...
}
return cell
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments