aqavi_paracha
aqavi_paracha

Reputation: 1131

iphone, multiple uiwindows in one iphone application

hi I am an iphone newbie, so a little confused in UIWindow concept. On Mac, we can use multiple NSWindows in one application, i guess. But in iphone, can we use multiple UIWindows in one iphone application. To be very specific, i have 3 xib files in my application: 1. MainWindow.xib 2. ViewController (coupled with appDelegate) 3. MyCustomViewController... wherein i want to use UIwindow and multiple views with that window.

Now my question is that i am already using UIWindow in MainWindow.xib, can i use use another UIWindow in MyCustomeViewController.xib???

Best regards

Upvotes: 0

Views: 2880

Answers (3)

hfossli
hfossli

Reputation: 22962

This is not the standard approach for iOS apps.

If you still want to do it see this answer

Advantages, problems, examples of adding another UIWindow to an iOS app?

Upvotes: 0

Kostiantyn Sokolinskyi
Kostiantyn Sokolinskyi

Reputation: 781

You don't need and shouldn't use several windows on iPhone according to the documentation.

What you need is to change view controllers currently present on the screen.

From you ViewController you can take to ways to present MyCustomViewController: 1. Employ UINavigationController's method - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated if case you put your ViewController inside a navigation controller.

  1. Use - (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated method of UIViewController class.

something like below inside you ViewController methods:

MyCustomViewController *vc = [MyCustomViewController new];
[self presentModalViewController: vc animated: YES];
[vc release];

see "View Controller Programming Guide for iOS" for exhaustive discussion: http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/Introduction/Introduction.html

Upvotes: 3

Asad Khan
Asad Khan

Reputation: 11899

You do not need to use another window just keep swapping views on the available UIWindow & you'll be fine.

Upvotes: 2

Related Questions