5

Hi I created UITableViewCell in ControllerA in Storyboard. I need use the same UITableViewcell in different ControllerB. I need achive this only with storyboard. Any idea how can I make it?

Roman Barzyczak
  • 3,785
  • 1
  • 30
  • 44
  • 1
    Here is already a solution: http://stackoverflow.com/questions/9245969/in-a-storyboard-how-to-make-a-custom-cell-for-use-with-multiple-controllers – Ashwani Aug 22 '13 at 12:44
  • You need to create an .xib file (In XCode 6 you can just copy paste contents of tableview cell after creating new xib file) – Nick Dec 15 '14 at 15:08

1 Answers1

1

you can use this like bellow :-

in story board you have to put another Table-cell into ControllerB nib and give it class name that you want to similar custom cell like bellow:-

enter image description here

and

enter image description here

and your ControllerB 's cellForRowAtIndexPath look like this

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

    Members_Cell *cell  = [tableView dequeueReusableCellWithIdentifier:@"Members_Cell"];

    cell.lblMemberName.text=[ArrSearchResult objectAtIndex:indexPath.row];

    return  cell;

}
Nitin Gohel
  • 49,482
  • 17
  • 105
  • 144
  • check properly this is working method that i used in my project i think you forget to set custome class of tableview's cell from story board at secondviewcontroller xib – Nitin Gohel Aug 22 '13 at 13:36
  • I need set custom class in ControllerA and ControllerB with the same identifier? – Roman Barzyczak Aug 22 '13 at 13:41