- (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;
}
网友评论