cocos2dx 和 iOS UIKIT的结合

  前俩年在cocos2d用过uikit,一直觉得uikit 做界面优势很明显,自从转-x后,很少用uikit了。今天看到一个博友的文章顿时觉得可以在-x下结合uikit  废话不多说了,直接上代码:

  

    id sth = [[UIApplication sharedApplication] delegate];

    if ([sth isKindOfClass:[AppController class]]) {

    

        MapSelViewController *mapSelViewController = [[MapSelViewController alloc]              initWithNibName:@"MapSelViewController" bundle:nil];

        [mapSelViewController.view setFrame:CGRectMake(-480, 0, mapSelViewController.view.frame.size.width, mapSelViewController.view.frame.size.height)];

        [mapSelViewController.view setTag:1015];

        AppController *controller = (AppController *)sth;

        

        [controller.viewController.view addSubview:mapSelViewController.view];

  }

你可能感兴趣的:(cocos2dx)