I’ve defined a custom UITableViewCell that I’m using in my static UITableView. I’d like to access the variables I’ve defined (myTableViewImageCell, etc) but doing it from tableView:willDisplayCell seems to say something along the lines of “redefinition of cell type.
Here’s what I’m doing:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
[cell.myTableViewLabel setShadowColor:[UIColor whiteColor]];
[cell.myTableViewLabel setShadowOffset:CGSizeMake(0.0f, 1.0f)];
}
If all of your cells are the same custom class, you can just change the definition of your method to indicate that and get rid of your first line (which is wrong anyway):
Note however, that if you are doing the same thing to all of your cells (as you show here), you should do this in
cellForRowAtIndexPath:instead ofwillDisplayCell:. That way, the code is run only once when the cell is created instead of every time that it is displayed.