Ios 在主视图设计中仅在细节视图中引入.xib
我已经看了一些例子,但我还不能让事情正常工作。我在一个大的代码库,这是一个通用的应用程序。我带来了一个.xib,就像这样:Ios 在主视图设计中仅在细节视图中引入.xib,ios,objective-c,master-detail,Ios,Objective C,Master Detail,我已经看了一些例子,但我还不能让事情正常工作。我在一个大的代码库,这是一个通用的应用程序。我带来了一个.xib,就像这样: TestView *newView = [[TestView alloc] init]; [self presentViewController:newView animated:YES completion:nil]; 这样在iPhone端就可以加载.xib,但在iPad sim卡中,.xib覆盖了整个屏幕。我如何才能使其仅涵盖详细信息视图?我知道在appdelega
TestView *newView =
[[TestView alloc] init];
[self presentViewController:newView animated:YES completion:nil];
这样在iPhone端就可以加载.xib,但在iPad sim卡中,.xib覆盖了整个屏幕。我如何才能使其仅涵盖详细信息视图?我知道在appdelegate中,它会生成两个视图控制器(即splitviewcontroller),但我没有选择这样做
[detailViewController presentViewController:newView animated:YES completion:nil];
您必须在AppDelegate中创建UISplitViewController的实例。UISplitViewController仅在iPad上可用,因此您必须将其包含在if语句中
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
UIViewController *master = [self buildMaster];
UIViewController *detail = [self buildDetail];
UISplitViewController *splitViewController = [[UISplitViewController alloc] init];
splitViewController.viewControllers = @[master, detail];
[self.window setRootViewController:splitViewController];
}