开发者

Declaring a View Controller with Objc?

How do you declare a view 开发者_JS百科controller with Objective C?


Sorta depends. Just to give one example, let's say you have a new project setup using apple's "View based app" template. If you want to have a new view "slide up" and replace your current view you can do this. Add a new file to you project of type 'UIViewController subclass', and select the 'With XIB for user interface' option. Now, in you code, when you want to display this view do this:

MyViewController *myViewController = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil];
[self presentModalViewController:myViewController animated:YES];
[myViewController release];

This is assuming that your new UIViewController subclass name is MyViewController and the the XIB is named MyViewController (so you should have MyViewController.c(.h)(.xib)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜