I have table view with button. I have added UIPanGestureRecognizer to button to allow user to move button horizontally. But then vertical scroll of whole table view does not work now when user touches the button. If I don’t use gesturerecognizer, vertical scroll works ok. How to allow users to move button horizontally and table view vertically?
I have table view with button. I have added UIPanGestureRecognizer to button to allow
Share
When you intercept the gesture recoginition, you are blocking the
UITableViewto get notified about the gesture event. To deal with this, in the same place (method) that you recognize a gesture, do a comparison. If it is a horizontal gensture (e.g. horizontal pan), do whatever you want to do, otherwise, pass it along the chain, so that the table view gets a chance to respond to it.EDIT
It depends what methods you have, and what methods you have overriden. Once you recognized the touch event. Here is an example:
You should call the same method on the next responder (or super).
References:
https://developer.apple.com/library/ios/#DOCUMENTATION/EventHandling/Conceptual/EventHandlingiPhoneOS/EventsiPhoneOS/EventsiPhoneOS.html#//apple_ref/doc/uid/TP40009541-CH2-SW5
https://developer.apple.com/library/ios/#documentation/uikit/reference/UIResponder_Class/Reference/Reference.html#//apple_ref/occ/cl/UIResponder
http://books.google.com/books?id=rk1EEL4WpFEC&lpg=PP1&pg=PA530#v=onepage&q&f=false