I have a scroll view set up, and inside one of it's children's children, I have a UIPickerView. So the user basically has a page they can scroll up and down on, with the picker being at the bottom. The problem I'm seeing is that the UIScrollView is 'greedy' for the swipe gesture - I can press on the UIPickerView to select things in it, but when I try a swiping motion on it to move the dial, the UIScrollView steals it.
Anyone have any recommendations to handle the swiping differently in this case? I basically want the UIPickerView to respond to swipes in it's view frame, but anywhere else, for the UIScrollView to act as it normally would.
Google produces no answers, so I'll have to rely on this forum's expertise to help me out on this one.
First, I tried subclassing the scroll view to access the touchesBegan/touchesEnded/touchesMoved methods, and just using NSLogs to make sure they were being called. Which they were! I could see that dragging/pressing was triggering the methods for my subclass.
However, if I pressed on something within my scrollview like a button, these methods were NOT called (including my picker). I'm guessing this is because they implement their own touch methods that get precedence over the scrollView. So, next I tried to subclass the picker and use the touchesBegan/Ended methods. No luck, they are not being called. And on top of that, dragging in the picker still triggers the scrollView, though it doesn't trigger the scrollView's touchesBegan/Ended methods that I implemented.
Still looking for a solution. If there are any event handling gurus out there, please speak out!
First, I tried subclassing the scroll view to access the touchesBegan/touchesEnded/touchesMoved methods, and just using NSLogs to make sure they were being called. Which they were! I could see that dragging/pressing was triggering the methods for my subclass.
However, if I pressed on something within my scrollview like a button, these methods were NOT called (including my picker). I'm guessing this is because they implement their own touch methods that get precedence over the scrollView. So, next I tried to subclass the picker and use the touchesBegan/Ended methods. No luck, they are not being called. And on top of that, dragging in the picker still triggers the scrollView, though it doesn't trigger the scrollView's touchesBegan/Ended methods that I implemented.
Still looking for a solution. If there are any event handling gurus out there, please speak out!
First, I tried subclassing the scroll view to access the touchesBegan/touchesEnded/touchesMoved methods, and just using NSLogs to make sure they were being called. Which they were! I could see that dragging/pressing was triggering the methods for my subclass.
However, if I pressed on something within my scrollview like a button, these methods were NOT called (including my picker). I'm guessing this is because they implement their own touch methods that get precedence over the scrollView. So, next I tried to subclass the picker and use the touchesBegan/Ended methods. No luck, they are not being called. And on top of that, dragging in the picker still triggers the scrollView, though it doesn't trigger the scrollView's touchesBegan/Ended methods that I implemented.
Still looking for a solution. If there are any event handling gurus out there, please speak out!
Thanks.
Firstly I am definitely no guru, but I got this to work by creating a UIScrollView subclass and overriding the following methods
There's no need to subclass UIScrollView for this.
After researching for a while (and I've also tried the approach discussed right here), I've seen that with just two lines you'll get the perfect result:
There's no need to subclass UIScrollView for this.
After researching for a while (and I've also tried the approach discussed right here), I've seen that with just two lines you'll get the perfect result:
But which control is drived from UIControl that controls are not make the scroll in scrollview.
Ex. we add the UIButton in UIScrollview then set the above mentioned property. That time the scroll function not enable in the UIButton region. But the UIPickerview control swipe or scroll. So we are override the UIScrollview function "- (BOOL)touchesShouldCancelInContentViewUIView *)view". So create the custom class inherited by UIScrollview and override that function like that EX.