I am trying to access a label property on a custom UiTableViewCell (subclassed UITableViewCell) from a UitableViewController class. For instance I have the heightForRowAtIndexPath method and I need to get access to the label.
Here is my code:
- (CGFloat)tableView:(UITableView *)tv heightForRowAtIndexPath:(NSIndexPath *)indexPath {
// I need access to the custom UITableView Cell property here
}
Any tips? Also is it even possible to declare the outlet in the uiviewcontroller and link it to the label on the custom uitableviewcell?
Thanks
For accessing cell from
heightForRowAtIndexPath:, check following:If you need to access cell’s label after it is initialized then you need to add
tagto the label in the custom UITableViewCell class and you can access the label as following: