开发者

Multiple view controllers with interface builder and an iPad

I am trying to create an application that has a main screen and then three buttons that would allow the user to switch to an entirely different "context" (so I have another screen that does some rendering using opengl and another that will do something comple开发者_开发问答tely different to what the main screen does).

My question is how do I create more than one view controller in interface builder and then how will I switch between the different view controllers? (I know this is not recommended by Apple but that is what I am trying to do)

Thanks for any help :)


how do I create more than one view controller in interface builder and then how will I switch between the different view controllers

I will base my answer in the part you say "more than one view controller in interface builder". I presume you have one or 2 (or n) ViewControllers (and not UIViews) in your NIB and you wanna "play around" with them. You could make something like this:

[self.view addSubview:myFirstViewController.view];

If you wanna switch to another:

[myFirstViewController removeFromSuperview];
[self.view addSubview:mySecondViewController.view];

Remember to have in your "rootViewController" and IBOulet in order to have a reference to your UIViewController. If you need more help, let me know.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜