Cocos2d + UIViewController switch -
its game cocos2d 2.1 beta.
i used seperate viewcontroller comes when pressing button. when fast switch between these 2 time game hangs...not crash..fps label works. stopanimation..
what's wrong code? how can avoid hang? when fast switched.
-(void)shownativeview { uiviewcontroller *controller = [[uiviewcontroller alloc] init]; appcontroller *app = (appcontroller*) [[uiapplication sharedapplication] delegate]; [[app navcontroller] presentmodalviewcontroller:controller animated:no]; [uiview animatewithduration:1.0 animations:^{controller.view.alpha = 1.0;}]; [controller release]; } -(void)gotogameagain { appcontroller *app = (appcontroller*) [[uiapplication sharedapplication] delegate]; [app navcontroller].modaltransitionstyle = uimodaltransitionstylecrossdissolve; [[app navcontroller] dismissmodalviewcontrolleranimated:yes]; }
do need initiate uiviewcontroller when button clicked? may better if initiate once , use when button clicked. initiating evertime clicked on button may creating performance issues during fast switch...