質問

For some reason my navigation controller isn't pushing properly.

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    NSLog(@"HERE!");
    MyViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"myVC"];
    vc.labelText = [self.myArray objectAtIndex:indexPath.row];
    [self.navigationController pushViewController:vc animated:YES];
    NSLog(@"Pushed");
}

The output is:

2014-02-17 12:41:47.187 TableViewTesting[37532:70b] HERE!
2014-02-17 12:41:47.189 TableViewTesting[37532:70b] Pushed

So it's all running fine, but I still just see my initial view controller even after tapping on a cell.

役に立ちましたか?

解決

Is the view controller from which you are calling this code embedded in the Navigation Controller? If it's not, then nothing would happen when you call pushViewController method.

Go to your Storyboard, select the initial view controller, then from the top bar Editor > Embed in > Navigation Controller and try again.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top