UITabbarController in UiSplitViewController

不打扰是莪最后的温柔 提交于 2019-12-23 00:24:13

问题


I am new to ipad development. I am developing an ipad application similar to the following apps:

http://itunes.apple.com/us/app/dropbox/id327630330?mt=8

http://itunes.apple.com/in/app/box.net/id290853822?mt=8...

In both these apps structure looks like uitabbarcontroller integrated inside uisplitviewcontroller. But i ve heard that uisplitviewcontroller cannot be a rootviewcontroller. Then how these apps designed??? How to do a structure like that???


回答1:


You're right that uisplitviewcontroller cannot be a rootviewcontroller. So, it has to be added as a subview as follows:

- (BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)options {
UIViewController *vc1 = [[CalculatorViewController alloc] init]; 
UIViewController *vc2 = [[GraphViewController alloc] init];
UISplitViewController*svc=[[UISplitViewControlleralloc]init];
svc.viewControllers = [NSArray arrayWithObjects:vc1, vc2, nil];
[vc1 release];  [vc2 release];
[window addSubview:svc.view]; 
[window makeKeyAndVisible]; 
return YES;}

Check out this sample available at developer.apple.com



来源:https://stackoverflow.com/questions/7159352/uitabbarcontroller-in-uisplitviewcontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!