1
CCLayerの中で、私はImagePicker/CameraをopenGLViewに追加してUIButtonに追加しました。すべていいですが、今はCCLabelを追加したいと思います。それらの要素のトップあなたは、次のようopenGLView下addSubview UIViewのコンポーネントに必要openGLViewのCCLabelオンタップを追加する - cocos2d iphone
uip = [[UIImagePickerController alloc] init];
uip.sourceType = UIImagePickerControllerSourceTypeCamera;
uip.showsCameraControls = NO;
uip.toolbarHidden = YES;
uip.navigationBarHidden = YES;
uip.wantsFullScreenLayout = YES;
uip.cameraViewTransform = CGAffineTransformScale(uip.cameraViewTransform, CAMERA_TRANSFORM, CAMERA_TRANSFORM);
[[[CCDirector sharedDirector] openGLView] addSubview:uip.view];
arrowButton = [UIButton buttonWithType:UIButtonTypeCustom];
[arrowButton addTarget:self
action:@selector(arrowButtonClicked:)
forControlEvents:UIControlEventTouchUpInside];
UIImage *imgNormal = [UIImage imageNamed:@"btn_next_norm.png"];
[arrowButton setImage:imgNormal forState:UIControlStateNormal];
UIImage *imgPressed = [UIImage imageNamed:@"btn_next_pressed.png"];
[arrowButton setImage:imgPressed forState:UIControlStateHighlighted];
arrowButton.frame = CGRectMake(screenSize.width - 48.0, screenSize.height - 37.0, 48.0, 37.0);
[[[CCDirector sharedDirector] openGLView] addSubview:arrowButton];
CCLabelTTF* label = [CCLabelTTF labelWithString:@"Experience 1" fontName:@"Arial" fontSize:32];
label.color = ccc3(0, 0, 0);
CGSize size = [[CCDirector sharedDirector] winSize];
label.position = CGPointMake(size.width/2, size.height/2);
// [[[CCDirector sharedDirector] openGLView] addSubview:labe]; cant add to openGLView
申し訳ありませんが、私はUIImagePickerControllerの上にラベルを表示することです - UIImagePickerControllerの上にココスを移動する – daidai
私の答えを更新しました。 –
ご協力ありがとうございますが、Cocosの要素が表示されません。[CCDirector sharedDirector] .openGLView.backgroundColor = [UIColor clearColor]; [CCDirector sharedDirector] .openGLView.opaque = NO; glBlendFunc(GL_ONE、GL_ONE_MINUS_SRC_ALPHA); glClearColor(0.0、0.0、0.0、0.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); [[[CCDirector sharedDirector] openGLView] .superview addSubview:uip.view]を追加しました。 [[[CCDirector sharedDirector] openGLView] removeFromSuperview]; [uip.cameraOverlayView addSubview:[[CCDirector sharedDirector] openGLView]]; – daidai