1

For reference:

TABLEVIEW (1 section - 3 rows) in each row I have a custom cell that contains another tableview.

the tableview inside the custom cell is subclassed with a uitableviewcell where I implement all of my delegates, like cellforrow etc. etc., and the file owner of the table view inside the UITableView cell is with my UIViewController.

How can I perform segue using the subclass UITableViewCell?

Any ideas what to do?

NOTE: I am using the tableview on the UITableViewCell as subclass.

Darshan Kunjadiya
  • 3,323
  • 1
  • 29
  • 31
fanboy
  • 31
  • 1
  • 7
  • Typically, segue is used to implement transition between two view controllers. Did you put all the stuffs in the same view controller? – kukushi Apr 25 '14 at 03:36

1 Answers1

0

control drag From View Controller to View Controller

From View Controller to View Controlle!

You will need to give an identifier to your segue:

enter image description here

Perform the segue:

didSelectRowAtIndexPath

 -(void)tableView:(UITableView *)tableView 
                            didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
   [self performSegueWithIdentifier:@"yourSegue" sender:sender];
 }

Now here is the thing, this will just perform the segue, if you ever needed to pass some data to that view controller. Then you have to implement the following segue deleguate:

prepareForSegue

 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Make sure your segue name in storyboard is the same as this line
    if ([[segue identifier] isEqualToString:@"yourSegue"])
    {  
       //pass data here
    }
}
meda
  • 45,103
  • 14
  • 92
  • 122
  • this does not work for me. already tried this. Screenshot: http://i1262.photobucket.com/albums/ii615/jorelkimcruz/ScreenShot2014-04-25at124607PM_zps24e29260.png *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver () has no segue with identifier 'moviedetail'' but already set my segue identifier on the storyboard – fanboy Apr 25 '14 at 04:51
  • @FanBoy-designAnd-concept I expanded on my answer – meda Apr 25 '14 at 11:29
  • this dont work for UITableViewCell type of class, fixed my problem by redoing the task. instead of using the UITableViewCell as a sublcass of a UITableView. i programmatically made the tableViews to the viewcontrollers. because UITableViewCell doesnt recognize the segues. AFAIK. anyways thanks for the answer. – fanboy Apr 28 '14 at 03:09