I'm creating my own custom UITableViewCell to use as the backend of a prototype cell. In my class I override the initwithstyle:reuseIdentifier: method to do some custom initialization, but my initializer is not called. I have a break point on the first line inside of it, as well as a break point on dequeueResusableCellWithIdentifier:. The dequeueResusableCellWithIdentifier: method is called, and it returns a initilized cell, but the break point in initwithstyle:reuseIdentifier: is not reached. Any help would be great.
If your cell is being created from a storyboard prototype (which you have declared as the custom class in IB) then it won't be created with initWithStyle... but initWithCoder: instead, like any other object loaded from a nib. If you have any setup code, it should be in there or in awakeFromNib.
With the storyboard involved, everything changes. This is the method that gets called.
-(id)initWithCoder:(NSCoder *)aDecoder { if ( !(self = [super initWithCoder:aDecoder]) ) return nil; // Your code goes here! return self; }
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