UISplitView选择一行后崩溃
问题描述:
我有一个UISPlitViewController
,我有一个UITableView
在我的rootView和有一个detailView,选择第二行在我的rootView,我想要做的是:删除UISplitViewController
并添加一个新的UISplitViewController
(根据我的要求),所以在肖像模式下,当我从popOver中选择第二行时,应用程序崩溃? (但在横向模式下效果很好)。UISplitView选择一行后崩溃
答
我100%确定我可以回答这个问题,但如果您发布了一些代码,这将有所帮助。你现在使用什么代码来处理风景,但是在肖像中崩溃?
(我会在评论中写这个,但我需要50个代表)。
答
[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的,(根据我的要求)IM切除整个SPLITVIEW并增添新的SPLITVIEW,但如果IM在横向模式下,应用程序犯规崩溃,当我把我的iPad在Potrait模式下,当我点击工具栏中的按钮,并在弹出窗口中,当我在rootView中选择相同的第二行时,应用程序崩溃.....希望你现在明白了....