4
我试图通过使用此代码做一个UI按钮切换按钮:当选择UIButton时,这个按钮是什么东西?
- (void)tapButton:(id)sender{
UIButton *button = sender;
if (!button.selected){
[self performSelector:@selector(highlight:) withObject:button afterDelay:0.0];
}else{
[self performSelector:@selector(removeHighlight:) withObject:button afterDelay:0.0];
}
}
- (void)highlight:(UIButton *)button{
button.selected = !button.selected;
button.highlighted = YES;
}
- (void)removeHighlight:(UIButton *)button{
button.selected = !button.selected;
button.highlighted = NO;
}
但是,我得到一个奇怪的假象,当按钮处于选择的模式。
未选择:
选择:
Thanx。非常感激。 – smileBot