I have transparent UIImageView and UIScrollView under it , I want the UIImageView to recognize and process swipe gesture right and left , and pass the scroll up an down to the UIScrollView
How can I do it?
I added the swipe gestures to the image view and handle them, but I didn't find a way to pass the scrolling from the UIImage to UIScroll
You could could set the userInteractionEnabled property of the scroll view to NO and add several gesture recognizers to handle the different events (horizontal and vertical scrolling).
Related
I have a UIScrollView in which there are many CALayer objects as sub layer. I am able to capture the touches in all these layers if the userInteraction of the scrollView is disabled. But in this case, scroll is not possible. I now want to capture the touches and also enable scrolling of the scrollView. Any Ideas how this can be done?
I put one UIImageview as subview in a UIScrollview. When I zoom in the image, I can scroll the image around. Can I disable the scrolling when I touch and moving in a rectangle area of the image?
I want to get information from touchesBegan() of customed UIScrollview and customed UIImageview, but I found that when there are scrolling, no touchesBegan is called in customed UIImageview.
yourScrollView.scrollEnabled = YES; for scroll to be enabled.
yourScrollView.scrollEnabled = NO; for scroll to be disabled.
I am stuck with a problem actually the scene is like this in my view controller i have place several buttons which i can move within the view now in same view half of the screens is occupied by uiscrollview in this scrollview also i have several uibuttons which i want to move from uiscrollview to uiview Now when i try to move uibutton from uiscrollview to uiview it hides as it moves from the scrollview similarly as i move uibutton from uiview to uiscrollview then also it hides as my drag reaches the scrollview area.
Please help me out with this problem
Thanks in advance....
Your UIButtons each have a superview. For the UIButtons in the scrollview, the UIScrollView is the superview. When you have scrollView.clipsToBounds == YES, then the UIButtons in the scrollview will become obscured if you move them outside of the visible area of the scrollview.
There are several possible solutions, including:
Add code to change the superview of the UIButtons once they reach the edge of the scrollview (but this is tricky, and I wouldn't do it unless there was an easier option, check out Apple's UIView documentation, especially (UIView)removeFromSuperview and (UIView)addSubview:). You would have to perform this switch of superview in the code that moves the button (or tracks the move).
Add the UIButtons to a UIView which is the parent of the scrollview, maybe even your viewcontroller.view (but your UIButtons in the scrollview will no longer move with the scrollview upon scrolling). You would add the buttons to the view behind the scrollview, but so that they show above it.
I have displaying image thumbnails in a UIScrollView, if user taps on a thumbnail, the application should open that image. if, however, user drags on a thumb, the scroll view should pan. Right now the scrollview only scrolls if user is able to drag on the small empty space between the thumbnails. the subviews (the one's displaying image thumbs) use a UITapGestureRecognizer to detect taps, and exclusiveTouch on subviews is set to NO, UIScrollView has its canCancelContentTouches set to false.
Try leaving canCancelContentTouches set to YES, that allows the scroll view to override its subviews if it seems the user is trying to scroll.
I have two UIImageView objects inside my view (both 320x480 one above the other). The lower image view is inside a UIScrollView with scrolling and zooming enabled. Now I want to handle touches inside the other image view but it no longer detects any single taps.
I can understand that the UIScrollView handles all the touches which I do on it. But the touches on the image view above the scroll view are also not recognized.
Attached is an image with my view hierarchy. Can someone please tell me why the other image view's touches are also handled by the scrollview when it isn't a subview of scroll view?
And if the scrollview is bent on handling touches, how do I recognize touches on the other image view?
Thanks.
By default UIImageViews have userInteractionEnabled=NO;
Try setting it to YES (either in IB or in code).
I'm not sure, it might be that you need to set the frame size and/or content size of the scroll view properly. This page has a diagram of what I'm talking about.