切换按钮出现在我的所有其他图层中,我想知道是否有办法只出现在某个图层中。
.h 文件
UISwitch *muteSwitch;
.m 文件
muteSwitch = [[ UISwitch alloc ] initWithFrame: CGRectMake(0, 290, 0, 0) ];
muteSwitch.on = YES;
[muteSwitch addTarget:self action:@selector(soundOnOrOff:) forControlEvents:UIControlEventValueChanged];
[[[CCDirector sharedDirector] openGLView] addSubview:muteSwitch];
[muteSwitch release];
- (void)soundOnOrOff:(id)sender
{
if ([[SimpleAudioEngine sharedEngine] mute]) {
// This will unmute the sound
[[SimpleAudioEngine sharedEngine] setMute:0];
}
else {
//This will mute the sound
[[SimpleAudioEngine sharedEngine] setMute:1];
}
}