【发布时间】:2013-07-15 11:07:53
【问题描述】:
我正在尝试使用以下代码将 UI Button 设为切换按钮:
- (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;
}
但是,当按钮处于选定模式时,我得到了一个奇怪的伪像。
未选择:
已选择:
【问题讨论】:
标签: ios uibutton uikit selected uicontrol