2012-09-20 83 views

回答

1

它应该只是返回一个UIView。该“的Cocos2D与UIKit的意见”模板工程采用alternateView方法来创建正是这种集装箱观点:

@implementation AppDelegate 

-(id) alternateView 
{ 
    // we want to be a dummy view the self.view to which we add the glView plus all other UIKit views 
    KKAppDelegate* appDelegate = (KKAppDelegate*)[UIApplication sharedApplication].delegate; 

    // add a dummy UIView to the view controller, which in turn will have the glView and later other UIKit views added to it 
    CGRect bounds = [appDelegate.window bounds]; 
    UIView* dummyView = [[UIView alloc] initWithFrame:bounds]; 
    [dummyView addSubview:[CCDirector sharedDirector].view]; 

    return dummyView; 
} 

@end 

此代码放在你的项目的AppDelegate.m

+0

感谢斯特芬。作为Kobold2D的新手,有时候“明显”并不明显。现在我可以看到真正有用的结构。 –

+1

再次嗨。我试过把这段代码放到alternateView中,并在其中放置一个断点,但它看起来像函数永远不会被调用。是否有需要设置以确保alternateView被调用的开关/配置? –

+0

嗨保罗,你有没有找到解决方案? – user810395

相关问题