UISearchBar 取消按钮一直响应事件

- (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;

}

}

你可能感兴趣的:(UISearchBar 取消按钮一直响应事件)