[英]UIButton highlighted when pressed
I have two UIButtons
. 我有两个UIButtons
。 I was able to make them highlighted when pressed. 按下时我能够突出显示它们。 : :
-(IBAction) button1Pressed:(id)sender {
[self performSelector:@selector(highlightButton1:) withObject:sender afterDelay:0.0];
}
- (void)highlightButton1:(UIButton *)a {
[a setHighlighted:YES];
}
-(IBAction) button2Pressed:(id)sender {
[self performSelector:@selector(highlightButton2:) withObject:sender afterDelay:0.0];
}
- (void)highlightButton2:(UIButton *)b {
[b setHighlighted:YES];
}
I wanted to unhighlight a button when the other button is highlighted. 当其他按钮突出显示时,我想取消突出显示一个按钮。 But I can't make it work. 但我不能让它发挥作用。
If you really have your buttons defined as: 如果您确实将按钮定义为:
IBOutlet NSButton * mode1;
IBOutlet NSButton * mode2;
then you can do: 然后你可以这样做:
- (void)highlightButton1:(UIButton *)a {
[mode1 setHighlighted:YES];
[mode2 setHighlited:NO];
}
- (void)highlightButton2:(UIButton *)b {
[mode1 setHighlighted:NO];
[mode2 setHighlited:YES];
}
parameters a & b are ignored in this particular case... 在这种特殊情况下,参数a和b被忽略......
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.