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]; // 值改变时触发此事件

 

posted @ 2013-02-04 15:11  diablo大王  阅读(300)  评论(0编辑  收藏  举报