Reputation: 801
i'm working with cocos2d on iPad and i'm using ccviewcontroller class to help integrate UIKit and cocos2d. I've set up a storyboard and have an initial view controller and i'm using this code to set up the CCGLView:
CCGLView *glView = [CCGLView viewWithFrame:[[[UIApplication sharedApplication] keyWindow] bounds]
pixelFormat:kEAGLColorFormatRGB565
depthFormat:0
preserveBackbuffer:NO
sharegroup:nil
multiSampling:NO
numberOfSamples:0];
but for some reason the keyWindow bounds returns 0 and the keyWindow is nil. I'm not sure why this is happening. I have the project using storyboards and have an initial view controller set so i'm kinda stumped. Any help would be great! Thanks!
Upvotes: 0
Views: 2178
Reputation: 1398
Replace your code with this and njoy.
UIWindow *keyWindow = [[[UIApplication sharedApplication] delegate] window];
Upvotes: 0
Reputation: 41622
Using a storyboard, you need a window property on the app delegate, and the launch mechanism creates and sets that object for you.
Upvotes: 1