为了防止操作组件时cocos2d的动画停止不动,找到CCDirectorIOS.m文件,找到如下代码:
//
// If you want to attach the opengl view into UIScrollView
// uncomment this line to prevent 'freezing'.
// It doesn't work on with the Fast Director
//
// [[NSRunLoop currentRunLoop] addTimer:animationTimer
//
去掉注释。然后在AppDelegate.m中华将下面代码注释:
if( ! [CCDirector setDirectorType:kCCDirectorTypeDisplayLink] )
创建一个UIViewController类,名字为: MyUIViewController
自己根据需要添加内容
然后修改HelloWorldLayout.m
-(id) init
{
if( (self=[super init])) {
MyUIView *view = [[MyUIView alloc] initWithNibName:@"MyUIView" bundle:nil];
[[[CCDirector sharedDirector] openGLView] addSubview:view.view];
}
return self;
}
删除添加的组件:
[self.updateUIView.view removeFromSuperview];
这样后还要加上[self.updateUIView.view release];这样才真正的从内存中释放掉~
转载于:https://www.cnblogs.com/gtts/archive/2012/03/25/2416368.html
最后
以上就是超帅八宝粥最近收集整理的关于在cocos2d中添加UIKit组件的全部内容,更多相关在cocos2d中添加UIKit组件内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复