开发者

How to create multiple Views for the same Window in Cocoa?

I have application that has one Application delegate, and one Window. I have different classes that running threads, etc. When I'm sending NSWindow *window pointer to that classes or function, and trying to change VIew , [window setcontentView//something]. It doesn't display anything ,what I am doing wrong ? What is the easiest way to 开发者_运维百科have one window, and different classes, and change that Content for that window, from different classes. Thanks.


At first you should implement your UIApplicationDelegate method didFinishLaunchingWithOptions something like this:

MainViewController *mainController = [[[MainViewController alloc] initWithNibName:@"MainView" bundle:nil] autorelease];
navigationController = [[UINavigationController alloc] initWithRootViewController:mainController];
navigationController.navigationBar.hidden = YES;
[self.window addSubview:navigationController.view];
[self.window makeKeyAndVisible];

Later you can create different UIViewController instances and push them to UINavigationController object.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜