Reputation: 67
I have a custom UITableViewCell
with a UILabel
called CellLabel
. I want to be able to access this label at a certain tableView section
e.g. section 3 and provide it a string to display without the use of an array and arrayName[indexPath.section]
.
Upvotes: 2
Views: 1175
Reputation: 7013
You can catch it in cellForRowAtIndexPath
override of a TableView
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell:UITableViewCell = tableView.dequeueReusableCellWithIdentifier("YourCustomCellRegisterName") as YourCustomCell
if(indexPath.section == 3){
cell.CellLabel.text = "foo"
}
return cell
}
Upvotes: 1