开发者

UIViewController Question

开发者 https://www.devze.com 2023-03-18 22:19 出处:网络
I am setting up a Window-based application my first question is why would I use this instead of a view-based application. If I wanted to display my content I would need to create a ViewController corr

I am setting up a Window-based application my first question is why would I use this instead of a view-based application. If I wanted to display my content I would need to create a ViewController correct? Secondly How do I go about calling 开发者_运维百科a ViewController to open say when I use a button or a PageControl.


When you create a new project the wizard tells you when you might find them useful

Window-based Application

This template provides a starting point for any application. It provides just an application delegate and a window.

View-based Application

This template provides a starting point for an application that uses a single view. It provides a view controller to manage the view, and a nib file that contains the view.

These are only templates and can be changed any way you wish. The Window-based app is more bare bones and the View-based application template just sets up your first view.

For your second question you collect the button event and then create your new view controller and either present it modally or if you use a navigation controller you push it onto the stack.

If you present modally it may look something like this:

- (IBAction)nextViewButtonPressed:(id)sender
{
  NextViewController *nextViewController = [[NextViewController alloc] init];
  [self presentModalViewController:nextViewController animated:YES];
  [nextViewController release]; nextViewController = nil;
}
0

精彩评论

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