UISWitch颜色大小设置
2016-10-11 本文已影响87人
未来可期me
- (void)addSwitch {
UISwitch *switchBtn = [[UISwitch alloc] initWithFrame:CGRectMake(MainScreenWidth-60, 28, 40, 20)];
switchBtn.transform = CGAffineTransformMakeScale(0.75, 0.75);
switchBtn.onTintColor = BLUECOLOR;
switchBtn.tag = 10000;
[switchBtn addTarget:self action:@selector(subscribeTopic:) forControlEvents:UIControlEventValueChanged];
[_titleImage addSubview:switchBtn];
}
- (void)subscribeTopic:(UISwitch *)sender {
NSString *url;
if (sender.on) {
url = API_URL_DoFollowTopic;
}else {
url = API_URL_UnFollowTopic;
}