You set the UITableViewCell class to your CustomCell class, and you define the IBoutlet class in CustomCell and connect them.
And then you set your Xib file owner to your ViewController , and in ViewController you declare
IBOutlet CustomCell *yourClassLevelCell;
and connect this IBoutlet to your Xib UITableViewCell
now when you initialize the cell inside your ViewController's cellForRowAtIndexPath , you will add the target manually, something like this:
CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil]; cell = yourClassLevelCell; [cell.button addTarget:self ... ];
source share