UISearchBar not receiving touches when moved to top of screen
I have a UISearchBar as a subview of a UIViewController's view. The UIViewController has a navigation bar. When I touch on the UISearchBar, I initiate an animation that moves the navigation bar up 开发者_Python百科and off of the screen and move the search bar up to be in place of the navigation bar.
When I do this, the cancel button belonging to the search bar does not send touch events to the search bar's delegate. When I move the search bar up a few pixels, the search bar cancel button still works.
Any suggestions on what I might be doing wrong?
How do you get the touch events (UIGestureRecognizers?)? Are you sure the UISearchBar is not behind any other view (maybe with a transparent background)? This might cause that your touch events are sent to this overlaying view. Also possible issue might be you moved the UISearchBar out its super view. Check by giving its super view some backgroundColor.
精彩评论