I have custom and very simple UITableViewCell.
I just want to init my table view by using new technique in ios 6, i.e. registering class and after deque cell with identifier.
So i have UITableViewController, inside the tableview i have one prototype cell , here is the image of it.
at first i forgot to register the class in viewDidLoad method inside the Table View controller and it was working fine. here is the code.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:@"customCellIdentifier" forIndexPath:indexPath];
return cell;
}
but in this case
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
is not called during the cell init process.
and the after i put the register class functionality inside the viewdidload. here is the code
- (void)viewDidLoad
{
[super viewDidLoad];
[self.tableView registerClass:[CustomCell class] forCellReuseIdentifier:@"customCellIdentifier"];
}
after it the - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
starts invoking but in this case the cells are absolutely empty when i'm trying to debug , inside the initwithstyle method all the outlets are nil.
whats going on? what i'm doing wrong?