Reputation: 258
im trying to get the UILabel
from tableview cell I used viewWithTag:
but UILabel
i created showing always nil
in tableview:cellFroRowAtIndexPath:
.
UILabel *myLabel = (UILabel*)[tableview viewWithTag:25];
myLabel
is returning nil
Upvotes: 0
Views: 1052
Reputation: 8202
As per my comment, if the label is part of the cell, use the cell
as the receiver for the method.
UILabel *myLabel = (UILabel*)[cell viewWithTag:25];
If you've added myLabel
to the contentView
of the cell - which you should - use that as the receiver instead.
UILabel *myLabel = (UILabel*)[cell.contentView viewWithTag:25];
Upvotes: 3