static NSString *cellIdentifier = @"cell";
if (tableView ==tableview1)
{
ContactCustom *cell1=(ContactCustom *) [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell1 == nil)
{
[[NSBundle mainBundle] loadNibNamed:@"ContactCustom" owner:self options:nil];
cell1 = contactCustom;
}
}
How to register nib name in viewDidLoad
method before calling cellForRowAtIndex
method?
See here: http://mrmaksimize.com/Custom-UITableViewCell-With-NIB/
Later in code:
Registers a nib object containing a cell with the table view under a specified identifier.
nib A nib object that specifies the nib file to use to create the cell. This parameter cannot be nil. identifier The reuse identifier for the cell. This parameter must not be nil and must not be an empty string.
This doc can help you a lot
Just put oneline in your viewdidload, you must have table outlet,cell identifier,cell class.
For Swift