您的位置:首页 > 产品设计 > UI/UE

iOS---UISwitch控件

2015-12-19 13:00 316 查看
/** 声音 */

@property(nonatomic,strong)
UISwitch *soundSwitch;

cell.textLabel.text=@"声音";

[ _soundSwitch
addTarget: self
action:@selector(soundSwitch:)
forControlEvents:UIControlEventValueChanged];

_soundSwitch = [[UISwitch
alloc] init];

[_soundSwitch setOn:YES];

cell.accessoryView =
_soundSwitch;

/** ---------------------------------------------------------------------------*/

#pragma mark - 声音

- (void) soundSwitch:(id)sender{

UISwitch *switchButton = (UISwitch*)sender;

BOOL isButtonOn = [switchButton
isOn];

if (isButtonOn) {

NSLog(@"
打开 ");

}else {

NSLog(@"
关闭 ");

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: