UISwitch 详解

1 UISwitch *sw = [[UISwitch alloc] initWithFrame:CGRectMake(0, 0, 100, 50)];
2     sw.on = YES;    // 开启
3     [sw addTarget:self
4            action:@selector(mySwitch:)
5  forControlEvents:UIControlEventValueChanged]; // 值改变时触发此事件
原文地址:https://www.cnblogs.com/sell/p/2891834.html