In iOS 6 the Cancel and Clear button in UISearchBar
work with single click but in iOS 7 it takes long tap and hold to get them work. I am confused why is it so?
I want those buttons to work with a single click in iOS 7 as well.
Asked
Active
Viewed 119 times
0

Balaji Kandasamy
- 4,446
- 10
- 40
- 58

dev gr
- 2,409
- 1
- 21
- 33
-
This should work with a single tap. I have implemented a searchbar with ios7 and it works fine. How do you create the search bar ? – giorashc Feb 10 '14 at 09:12
-
check this : http://stackoverflow.com/questions/19160254/uisearchbars-cancel-and-clear-buttons-not-working-in-ios-7 – Dhaval Bhadania Feb 10 '14 at 09:13
-
@giorashc- I have created UISearchBar in xib file. Cancel button delegate method is getting called but only after long tap and hold in iOS 7. In iOS 6 everything is working just fine. – dev gr Feb 10 '14 at 09:26
-
@balajimca - I am not using UISearchDisplayController stuff. – dev gr Feb 10 '14 at 14:57
2 Answers
0
Maybe have a view(or something else) overlap this Cancel/Clear button. Or it's not have the right frame. So it's just work when you tap on the right position and this behavior make user confuse and they think those button not work.

lee
- 7,955
- 8
- 44
- 60
-
UISearchBar automatically sets frame for its Cancel button. Its working after long tap and hold by the way. – dev gr Feb 10 '14 at 11:16
0
My Bad. In one of the implementation files a category was written on UIButton purposefully. See code below:
@implementation UIButton(PassTapGesture)
-(BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
return YES;
}
@end
I just removed above code and everything is charm in iOS 7 too. Still I am confused that with the same code why it was working in iOS 6.

dev gr
- 2,409
- 1
- 21
- 33