In UISplitViewController, can't make showDetailViewController:sender: push onto detail navigationController

前端 未结 3 725
不思量自难忘°
不思量自难忘° 2021-02-07 03:28

In iOS 8, view controllers can now call showDetailViewController:sender: to have the system determine the proper view controller to present the detail view controll

3条回答
  •  南旧
    南旧 (楼主)
    2021-02-07 04:09

    The way You doing it have a problem. If your rotate the device(change the mode from collapsed to allVisible) after you select, you will find the detail vc without a navigation controller.

    If you call showDetailViewController:sender: in all cases and pass the view controller with a navigation controller it will work fine in both cases and also will fix the rotaion problem mentioned above.

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
        self.itemVC.item = self.itemStore.items[indexPath.row];
    
        UIViewController *vcToShow= [[UINavigationController alloc] initWithRootViewController:self.itemVC];
        [self showDetailViewController:vcToShow sender:self];
    }
    

提交回复
热议问题