I am pretty new to objective-c and have a question regarding prototype cells.
I have a tableview with custom cells, and it works nicely.
Now I have also in my custom cell class overridden -(id)init and -(id)initWithStyle: reuseIdentifier:
If I do a class check on the cell, it is clearly of my custom class, but neither init method is ever called.
So it creates them for me, but somehow avoids firing -(id)init which seems wierd to me.
I guess I could init them on my own but it seems really wierd that they can exist without having been created?
Thank you!
If its a prototype cell from a story board. - (id)initWithCoder: gets called. So you need to override:
- (id)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
//custom stuff here
}
return self;
}
This is true for anything awakened from a storyboard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With