0

我有一个UISPlitViewController,我的UITableViewrootView 中有一个 detailView,在我的 rootView 中选择第二行时,我想要做的是:删除UISplitViewController并添加一个新的UISplitViewController(根据我的要求),所以在纵向模式下当我从 popOver 中选择第二行时,应用程序崩溃了?(但在横向模式下效果很好)。

4

2 回答 2

0

我 100% 确定我可以回答这个问题,但如果您发布一些代码会有所帮助。您现在使用什么代码适用于横向但纵向崩溃?

(我会在评论中写下这个,但我需要 50 个代表)。

于 2012-05-11T13:01:44.950 回答
0
    [splitViewController.view removeFromSuperview];

    splitViewController = [[UISplitViewController alloc] init];

    rootObj  = [[HotelsRootViewController alloc] init];        
    mapObj = [[mapViewController alloc] init];
    rootObj.mapObj = mapObj;

    UINavigationController *rootNav=[[UINavigationController alloc]initWithRootViewController:rootObj];
    UINavigationController *detailNav=[[UINavigationController alloc]initWithRootViewController:mapObj];
    [mapObj release];

    splitViewController.viewControllers=[NSArray arrayWithObjects:rootNav,detailNav,nil];
    splitViewController.delegate=mapObj;
    [window addSubview:splitViewController.view];
    [window makeKeyAndVisible];

这就是我在 rootViewController 中选择第二行时所做的,我删除了整个 splitView 并添加了一个新的 SplitView(根据我的要求),但是如果我处于横向模式,当我打开我的 iPad 时,应用程序不会崩溃Potrait 模式,当我单击工具栏中的按钮和 popOver 中的按钮时,当我在 rootView 中选择相同的第二行时,应用程序正在崩溃.....希望你现在明白......

于 2012-05-14T04:49:58.973 回答