5

有什么方法可以显示UISplitViewControlleron button click 吗?

4

1 回答 1

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
于 2013-01-17T10:27:54.223 回答