How to return cell number in cell label
I have a UITableViewCell, and in it i have two labels side by side. the one is editable. But the other one i want rep开发者_开发问答opulated with the actual row number of the cell...
Is this possible at all? where would i add the code to perform the calculation?
In the cellForRowAtIndex method set the label's text variable to the indexPath.row.
someLabel.text = [NSString stringWithFormat:@"%d", indexPath.row];
However, if you are using a UITableView subclass, make sure that you have made the NSObject subclass of it first with a property of someLabel.
精彩评论