Thursday, 26 September 2013

How do you programmatically do initial setup to a UITableViewCell created as a storyboard prototype?

How do you programmatically do initial setup to a UITableViewCell created
as a storyboard prototype?

I have a bunch of different cells created as prototypes in a storyboard,
but I have changes that apply to all cells of that type, so I only want to
do them once. But I don't think I can apply these changes in storyboard,
so I have to do them programmatically.
e.g. modifications to the CALayer of an image view in the cell, setting a
custom font on a label etc etc,.
Seems wasteful to have to redo this every time the cell recycles, but
there doesn't seem to be a good way to check if the cell is new or
recycled anymore, because the cell is never nil.
I suppose you could add a manual flag that indicates whether the cell is
new or not, seems like a hack though. Any other options?

No comments:

Post a Comment