0

I am learning iPhone development and in my application I have some view but I should use a window, so I want to call a window in an IBaction how can I call a window? I try to use the example with AppDelegate you can see my code :

- (IBAction)start:(id)sender {
self.window = [[[Game1ViewController alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
[self.window makeKeyAndVisible];
}

Game1ViewController is type UIWindow.

Best Regards

Stuart Siegler
  • 1,686
  • 4
  • 30
  • 38
AppPhone
  • 3
  • 4
  • You should really learn a little more about the differences of a UIWindow, a UIView and a UIViewController. – Till Apr 28 '12 at 17:04

1 Answers1

1

I believe your app only gets one window. On top of this you place different views. These can be anything that subclasses UIView. These can be controlled by a UIViewController. Usually there is some sort of design style that dictates how the app is structured, between UINavigationController, UITabController, Master/detail.

If you open Xcode and start with one of their templates such as master/detail you can see the transitions between views and how to make one appear/disappear and the interaction between view and view controller .

utahwithak
  • 6,235
  • 2
  • 40
  • 62
  • It is possible to add more than one window to an app - even if not recommended. Please note, that in normal cases you should create Views and not Windows. Check my problem from 2 years ago, there I created a second window too: http://stackoverflow.com/questions/4252053/putting-a-uiview-or-uiwindow-above-statusbar/4262114#4262114 – andreas Apr 29 '12 at 00:34