【发布时间】:2015-08-25 03:15:27
【问题描述】:
下面的代码使用 UISwitch 来切换我很幸运。 我需要一个 UIButton 来做同样的事情。不确定我需要更改哪些内容才能使其正常工作? 感谢您的帮助!
- (IBAction)switchNotes:(id)sender {
if([sender isOn]){
NSLog(@"Switch is ON");
for(UIButton *myButton in self.myButtonCollection) {
[myButton setTitleColor:[BT_color getColorFromHexString:@"#FFFF00"] forState:UIControlStateNormal];
[myButton setAlpha:1.0f];
}
} else{
NSLog(@"Switch is OFF");
for(UIButton *myButton in self.myButtonCollection) {
[myButton setTitleColor:[UIColor clearColor] forState:UIControlStateNormal];
[myButton setAlpha:1.0f];
}
}
}
【问题讨论】: