UISplitView with Multiple Detail Views (with Storyboard)

自闭症网瘾萝莉.ら 提交于 2019-12-06 02:59:46

Turns out you can use the interface builder to add NSObjects to View Controllers. Once I did that, I changed the NSObject's class to DFMSplitViewManager, set it as the SplitViewController's delegate, and it was pretty straight forward from there.

ray

I am facing exactly the same problem as yours. Don't know wether you find out the solution or not, here is the solution I found.

Use following code in your AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{    
    // Override point for customization after application launch.
    UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController;

    self.detailViewManager = [[DetailViewManager alloc] init];
    self.detailViewManager.splitViewController = splitViewController;
    self.detailViewManager.detailViewController = splitViewController.viewControllers.lastObject;
    splitViewController.delegate = self.detailViewManager;

    if ([splitViewController respondsToSelector:@selector(setPresentsWithGesture:)])
    [splitViewController setPresentsWithGesture:YES];

    return YES;
}  

The rest of code is the same as what Apple has provided.

Basically, self.detailViewManager is our split view controller, when you select cell in table, self.detailViewManager will reset the detail view (if I'm not wrong). I'm new to Xcode, so anyone please correct me if I'm wrong.

Here is the solution link, answered by hallmark.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!