有没有办法在按钮点击时显示UISplitViewController
?
答案 0 :(得分:0)
请使用以下代码..
@interface ...
-(IBAction)Btn_OpenSplitView:(id)sender;
@end
@implementation ...
-(IBAction)Btn_OpenSplitView:(id)sender {
UIViewController* secondVC = [[UIViewController alloc] initWithNibName:@"ContentView"
bundle:nil];
UIViewController* firstVC = [[UIViewController alloc] initWithNibName:@"MenuView"
bundle:nil
withContentViewController:secondVC];
UISplitViewController* splitVC = [[UISplitViewController alloc] init];
splitVC.viewControllers = [NSArray arrayWithObjects:firstVC, secondVC, nil];
[self addSubview:splitVC.view];
}
@end