开发者

How to load a View on a button press?

I am very new to iPhone Development so pardon me if this is a novice question. I have an app with a RootController that controls loading the various views. It initially loads a MenuView. The MenuView has a button that when a user clicks I want to open a whole different view (called InfoView) that displays some information about the app and a back button that takes the user back to the MenuView.

I开发者_StackOverflows there a way to call an IBAction function in the RootViewController from the MenuView?

Thanks in advance for the help.


In your button action, you need to do something like this:

UIViewController *nextController = [[UIViewController alloc] initWithNibName:... bundle:...];
[self.navigationController pushViewController:nextController animated:YES];
[nextController release];


Assuming your working with UIButtons you just hook up the Touch Up Inside event to an IBAction on your RootController in Interface Builder. If you're doing it in code you do something like this:

[button addTarget:rootController action:@selector(myActionOnRootController:) forControlEvents:(UIControlEventTouchUpInside)];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜