Monday, April 16, 2012

Accessing the contents of a selected subclasses UITableViewCell

If I've subclass UITableViewCell with say MySubclassedCell and it contains a few labels and an image, how would I go about accessing the contents of the subclassed cell in the didSelectRowAtIndexPath method?



Normally (without subclassing) I'd do this:



- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
}


and then go from there. Replacing MySubclassedCell doesn't work, so what if I need to access the properties of a subclassed cell?





No comments:

Post a Comment