I have a class that subclasses UITableViewCell. I need to initialize some of the values ββin the cell when it is created, and I create it using:
NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:nil options:nil];
I get the following method when subclassing through the Xcode "Add New File" interface:
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) { self.selectionStyle = UITableViewCellSelectionStyleBlue; [txtField setEnabled:YES]; [txtField setTextColor:[UIColor redColor]]; [txtField setPlaceholder:@"Fake Placeholder - Test Initialize"]; [contactBtn setEnabled:YES]; } return self; }
The code in this method is never executed. How can i do this? If this is not the method used to create the object (using NSBundle loadNibNamed), then what is it? How can I initialize a cell when it is created from nib this way?
Any help is greatly appreciated.
source share