0

I created the single view application using storyboard.

In storyboard file, i have three view controller

1-navigation controller 2-Recipe Book View Controller 3-View Controller

Prototype cell of the table view of Recipe Book View Controller is connected through push segue to View Controller.Is the problem Recipe Book View Controller does not navigate to View Controller? here is the sample of project for download. https://drive.google.com/open?id=0B5pNDpbvZ8SnLTd1R3NBTE1ReEk

  • 1
    https://stackoverflow.com/questions/22759167/how-to-make-a-push-segue-when-a-uitableviewcell-is-selected – Venk Jun 29 '17 at 11:35

4 Answers4

1

I just Check your project.

Do following steps:-

  1. In Main.storyboard, click on Push segue to ViewController and add name of identifier

  2. Go to ViewController.m and paste below code

    -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath  {
        [self performSegueWithIdentifier:@"yourSegueName" sender:self];
    }
    
iPeter
  • 1,330
  • 10
  • 26
Neha Gupta
  • 539
  • 3
  • 13
0

Following mistakes are found in your project.

  1. There is no class for Third VC.
  2. PrepareForSegue not implemented.
  3. You wanted to push VC on TableViewCell selection but there you does not implemented didSelect tableview delegate.
dahiya_boy
  • 9,298
  • 1
  • 30
  • 51
  • I am following this tutorial .. http://www.appcoda.com/use-storyboards-to-build-navigation-controller-and-table-view/ –  Jun 29 '17 at 12:15
  • @user2557829 Download full source project from appCoda and check the points that I mentioned. – dahiya_boy Jun 29 '17 at 12:35
  • Take ref : https://stackoverflow.com/questions/22759167/how-to-make-a-push-segue-when-a-uitableviewcell-is-selected – dahiya_boy Jun 29 '17 at 12:37
0

Select the segue connecting RecipeBookViewController to ViewController , Then give that segue an identifier, i.e. "ViewControllerSegue".

Implement the delegate method of table view and call the performSegueWithIdentifier method :

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    [self performSegueWithIdentifier:@"ViewControllerSegue" sender:tableView];
}
0

Based on your Source code you have to add some code & classes in your project to achieve your requirement.

1st You have to add RecipeViewController to control your Recipe List and Tableview both.

2nd as You have created this RecipeViewController you need to assign this class to respective ViewController in your storyboard.

3rd Assign Segue from PrototypeCell to ViewController where you need to push.

Hope you can understand whats wrong in your Code.

CodeChanger
  • 7,953
  • 5
  • 49
  • 80