سؤال

I have this view stack:

UIViewController --> (Modal segue) --> 
UITabBarController --> (relationship) --> 
UINavigationController --> (relationship) --> 
UITableViewController --> (segue) --> UIViewController

Here is my segue code in the UITableViewController:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"selected row...");
    [self performSegueWithIdentifier:@"showVmail" sender:self];
    NSLog(@"done segue");
}

- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([[segue identifier] isEqualToString:@"showVmail"]) {
        NSLog(@"Got segue request...");
        NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];

        [segue.destinationViewController setMyVmail: [self.vmails objectAtIndex:indexPath.row]];

    }
}

When I click on an item in the table view controller, I see these log messages:

selected row...
Got segue request...
Setting myVmail... // from the new view controller
done segue

And it doesn't move onto my new view controller. If I change to a Modal, segue it works, but of course there is no Back button. As far as I can see, Ive done everything correctly. Ive read many a response on stack overflow, with the same issue, and their resolution is to put in the UINavigationController. Ive already done this.

Any thoughts would be muchly appreciated!

هل كانت مفيدة؟

المحلول

I tried the suggestion seen else where that you should go back to simple cases. I changed the UINavigationController in the storyboard to point to a basic UIViewController and then for that to have a button that segued to another UIViewController. When I ran it, I still got my UITableViewController!

That is when I remembered that I was programatically filling in the objects in the UITabBarController, and that I wasn't invoking the UINavigationController, but skipping that and invoking the UITableViewController! So in fact, I really was having the same issue as everyone else, missing the UINavigationController !

Change my program in to link the UINavigationController instead of the UITableViewController and all is now working as expected.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top