2
  1. I create a scrollView using storyboard.
  2. I programticaly created 10 myController(which are UITableViewControllers) inside the scrollViewController, So I can use panGesture to switch between tables. and it's working fine.
  3. I created a tableViewController using storyboard, set myController to be the corresponding view controller.
  4. Embedded the tableViewController in navigation controller.
  5. Control drag from table cell to a new view controller to create a push segue.
  6. Setup segue.

when running the app, prepareForSegue: is never called.

Edit: After noticing this issue, I did the follow thing but with no luck.

I also set the segue identifier in storyboard correctly. and add the following code:

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

but when I tap any table cell on screen, program will crash with following error:

* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver () has no segue with identifier 'segueIdentifier'' * First throw call stack:

Why is that?

Strong84
  • 1,869
  • 2
  • 19
  • 24
  • 1
    The error is self-explanatory, isn't it? The segue you're trying to perform does not exist in your storyboard. You probably forgot to name it or there is a typo in the identifier. – Pier-Luc Gendreau Dec 29 '13 at 18:59
  • I did add segue identifier by clicking the segue icon and put text in identifier box. is that what you talked about? – Strong84 Dec 29 '13 at 19:02
  • Yes, although I'm pretty sure it has to do with your programmatically created controllers. Segues only work in tandem with storyboards, but you could try creating a manual segue. See: http://stackoverflow.com/questions/9674685/creating-a-segue-programmatically/17012857#17012857 – Pier-Luc Gendreau Dec 29 '13 at 19:09
  • I've checked the identifier again, no problem at all, exactly the same. – Strong84 Dec 29 '13 at 19:09
  • Does it match `segueIdentifier`? The two have to be the same. Also make sure that you hit enter (or return) after typing otherwise it won't set. – CaptJak Dec 29 '13 at 19:09
  • in didSelectRowAtIndexPath: I've added manual segue method. and tried control drag from tableviewcontrol(not from cell) to another viewcontroller. but still the same problem. – Strong84 Dec 29 '13 at 19:13
  • @CaptJak Exactly the same!!!! – Strong84 Dec 29 '13 at 19:14
  • And you still get the same error? – CaptJak Dec 29 '13 at 19:20
  • @CaptJak Yes! same error :( Where's the problem???? – Strong84 Dec 29 '13 at 19:24
  • What is `Receiver`? Is that another View Controller? Is that the tableViewControl? – CaptJak Dec 29 '13 at 19:26
  • @CaptJak it's the tableviewcontroller!! reason: 'Receiver () has no segue with identifier 'test'' – Strong84 Dec 29 '13 at 19:27
  • Just to clarify, you ctrl+click from the view controller (not the view) to the destination VC and named the segue "test". Then you put `[self performSegueWithIdentifier:@"test" sender:self];` right? Make sure it's the entire VC that you segue from, not just the view. – CaptJak Dec 29 '13 at 19:30
  • @CaptJak Yes, I'm sure I did exactly the same like you said. – Strong84 Dec 29 '13 at 19:32
  • I have no idea unless I see the storyboard as well as the rest of the tableviewcontroller. – CaptJak Dec 29 '13 at 19:36
  • @CaptJak I posted detail information on another question, would you have a look? Thank you so much! http://stackoverflow.com/questions/20842833/segue-with-correct-identifier-can-not-work – Strong84 Dec 31 '13 at 00:26
  • @Pier-LucGendreau I posted detail information on another question, would you have a look? Thank you so much! http://stackoverflow.com/questions/20842833/segue-with-correct-identifier-can-not-work – Strong84 Dec 31 '13 at 00:26

1 Answers1

1

I think your problem here "5. Control drag from table cell to a new view controller to create a push segue."

Try drag from your view controller (not your table cell) to new view controller and create push segue, then try with

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