UISearchBar 取消按钮一直响应事件
2016-12-22 本文已影响168人
郭大侠smile
- (void)changeSearhBarCancelBtn:(UIView *)view
{
if(view){
if ([view isKindOfClass:[UIButton class]]) {
UIButton *getBtn =(UIButton *)view;
int64_t delayInSeconds = .001;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[getBtn setEnabled:YES];
[getBtn setUserInteractionEnabled:YES];
[getBtn setTitleColor:LYColor(2) forState:UIControlStateReserved];
[getBtn setTitleColor:LYColor(2) forState:UIControlStateDisabled];
});
return;
}else{
for (UIView *subview in view.subviews) {
[subview changeSearhBarCancelBtn:subview];
}
}
}else{
return;
}
}