UIView + CCNode

1. CCNode + UIView - (OK)


-(void) addSomeCocoaTouch {
   
// regular text field with rounded corners
UITextField* textField = [[UITextField alloc] initWithFrame:
   
CGRectMake(40, 20, 200, 24)];
textField.text = @"Regular UITextField"; 
textField.borderStyle = UITextBorderStyleRoundedRect;
   
// get the cocos2d view (it's the EAGLView class which inherits from UIView) U
IView* glView = [CCDirector sharedDirector].openGLView;
   
// add the text field view to the cocos2d EAGLView 
[glView addSubview:textField];
   
// after that it’s safe to release the textField   
[textField release]; 
}

2. UIView + CCNode - (OK)
(1)

-(void) addSomeCocoaTouch {
   
// get the cocos2d view (it's the EAGLView class which inherits from UIView) UIView* glView = [CCDirector sharedDirector].openGLView;
// The dummy UIView is the superview of the glView
UIView* superview = glView.superview;
   
// UITextField initialization code omitted ...
   
// add the text fields to the dummy view 
[superview addSubview:textField]; 
[superview addSubview:textFieldSkinned];
         
// send the cocos2d view to the front so it is in front of the other views
 [superview bringSubviewToFront:glView]; 
       
// make the cocos2d view transparent 
glClearColor(0.0, 0.0, 0.0, 0.0);
 glView.opaque = NO; 
... } 

(2)

EAGLView *glView = [EAGLView viewWithFrame:[window bounds] pixelFormat:kEAGLColorFormatRGBA8
depthFormat:0]; 
(3) 
// This will disable all touch events on the cocos2d view 
// To enable the touch event of UIView.
glView.userInteractionEnabled = NO; 
3. UIView + CCNode + UIView  (OK)


4. CCNode + UIView + CCNode  (Cannot do this)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值