Adaptive show detail segue transformed to modal instead of push on iPhone when master view controller is a UITabBarController

后端 未结 3 1106
既然无缘
既然无缘 2021-02-07 09:41

In XCode 6, if you create a new project based on the Master-Detail Application template, you get a universal storyboard that is supposed to be good for all devices.

When

3条回答
  •  佛祖请我去吃肉
    2021-02-07 10:21

    The docs state when the split controller is collapsed, it handles showDetail by calling show on the master view controller, which in your case is a tab controller. You need to forward that on to the child nav controller as follows:

    1. Make a tab controller subclass.
    2. In the storyboard set the tab controller to use the new subclass.
    3. Add this method to the subclass:
    - (void)showViewController:(UIViewController *)vc sender:(id)sender{
        [self.viewControllers.firstObject showViewController:vc sender:sender];
    }
    

    This forwards it on to the nav controller in the first tab.

提交回复
热议问题