Figured out how to get UIKit and Cocos2D to work together. I’m launching my game play scene (which is supposed to be using Cocos2D) from a UITableViewCell. Problem is, after this method is run…
// MainViewController.h
MainViewController : UIViewController <CCDirectorDelegate,
UITableViewDelegate,
UITableViewDataSource,
GKGameCenterControllerDelegate>
// MainViewController.m
-(void)launchGamePlay {
[self.tableView removeFromSuperview];
// ... also removing buttons and other assets with removeFromSuperview
[mainNavBar removeFromSuperview];
[underView removeFromSuperview];
CCTransitionRotoZoom *transition = [CCTransitionRotoZoom transitionWithDuration:1.0 scene:[CCGamePlayLayer node]];
[[CCDirector sharedDirector] runWithScene:transition];
}
…I’m not able to receive touch input on the presented CCGamePlayLayer. I’ve tried messing around with zOrders for both the presenting view controller and the presented cocos scene to no avail. What am I doing wrong?
Most likely your MainViewController is receiving the touch input.
Override the various touchesBegan/Moved/Ended methods in the MainViewController and forward them to cocos2d’s view: