开发者

Ipad Application without nib starts and then immediately closes

Im writing an ipad application. So far what I have is a Delegate and Root view c开发者_Python百科ontroller which initializes the menu screen that starts the game.

I am not using a nib, so in my main class, i start the application with

UIApplicationMain(argc, argv, nil, @"PictionaryAppDelegate");

In my delegate, I have a applicationDidFinishLaunching method which creates an instance of the viewcontroller. In the viewcontroller, I have a load views method which sets up the menu view with all the buttons etc.

When I run it, it starts, and then automatically goes to the dealloc method of the delegate and ends. can someone please tell me why my menu isnt being loaded.

The entire project is attached here on media fire


You are doing:

- (void)loadView {

 CGRect rect = [[UIScreen mainScreen] applicationFrame];
 UIView *menuScreen = [self view];

This is a big no no.

loadView is there to generate the view if it is nil. So what you are doing here is you try to access view (which isn't in place yet as we are in loadView), and this calls loadView, and you get that endless recursion with an exploding stack.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜