你不能直接将UISlider作为cocos2d节点添加到图层/场景中.
您必须将其作为子视图添加到cocos2d图层.这是一个例子:
UISlider *sliderCtl = [[UISlider alloc]
initWithFrame:CGRectMake(170, 0, 125, 50)];
[sliderCtl addTarget:self action:@selector(sliderAction:)
forControlEvents:UIControlEventValueChanged];
sliderCtl.backgroundColor = [UIColor clearColor];
sliderCtl.value = 0;
[[[[CCDirector sharedDirector] openGLView] window]
addSubview:sliderCtl];
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3107 次 |
最近记录: |