I have view with CGPathRef and when user zooming this view by pinching view dont't reload:
But after zooming view reload:
However I need to reload view while user pinching it.
How can I do it? Or is it possible?
You can query for current pinching using the UIPinchGestureRecognizerStateChanged.
This has an example of how it is implemented: Max/Min Scale of Pinch Zoom in UIPinchGestureRecognizer - iPhone iOS
Related
I have a scrollview to which I have added an image view as a subview. The contentsize of the scrollview is same as the size of the imageview (width and height). There are two buttons outside the scrollview. When I click on either on them, a small rectangle view is added as a subview to the imageview. This rectangle view can be dragged anywhere on the imageview by the user after it has been added.
This works fine until I pinch to zoom the scrollview. In the viewForZoomingInScrollView: method, I return the imageview and the zooming works fine. But in the zoomed view when I try to drag around the rectangle view, it does not move. It does not recognize the pan gestures any more. Any idea why this is happening?
This Dragable view is too small and I have to change its position so I am zomming scrollview to touchable view.
I think you should do this:
Inform the delegate when the zoom is finished by calling:scrollViewDidEndZooming:withView:atScale:
in this method you update the parent view of the view where the rectangle can move or may be something else.....but you have to update something in this method....please put your specific code where the problem is.
I am working on application in which i need to zoom the scroll view on shake effect so user will not touch the screen to pinch or double tap.
I have implemented the code by looking in to this tutorial:
Zoom UIScrollView with multiple images
I got the call in a delegate:
viewForZoomingInScrollView
But the image view not zoom in or out.
When i touch the screen after the delegate called the scroll view is zoom in. But content in scroll view not zoom in or out. It remains as it is.
Even some time i did not get call in the following delegate:
scrollViewDidZoom
scrollViewDidEndZooming
So do i need to call layout subview after viewForZoomingInScrollView if yes where?
From my understanding the view is not zooming because i have not pinch or double tap the scroll view.
Please help me out.
Those you mentioned are UIScrollView delegate methods and they are called when the scrollView will\did actually zoom, not to perform the zooming.
To perform the zoom programmatically you need to use zoomToRect:animated: and passing the portion of your scorllView's subview you want to scroll and wether it needs to be animated or not.
Hope it helps.
When UIScrollview uses pinch gesture to zoom in then it transform it content view. The actual size of the child views remains same. I want to change the frame of all "subviews" as UIScroll zoom on pinch gesture.
I have a UIScrollView which has two pages and only scroll horizontally.
The scrolling and paging is controlled using a UIPageControl. I have placed a UIImageView on the scrollView which contains an image of an iPhone (shown in red in the image below) that says Hello inside page 1.
I wanted to animate the UIImageView to rotate and change its position as shown in the image when the user scrolls from page-1 to page-2. Also the animation should ideally rotate back when the user is scrolling back from page-2 to page-1.
The animation or movement of the UIImageView is based on how much the user is scrolling horizontally and not based on time.
How can I rotate the UIImageView back and forth based on the scroll position of the UIScrollView?
Set a delegate for your scroll view. Probably you want your view controller to be the delegate. You need to add UIScrollViewDelegate to its list of protocols.
Then, in the delegate, implement scrollViewDidScroll:. In scrollViewDidScroll:, look at the scroll view's contentOffset. Based on the contentOffset, set the image view's transform and center to rotate and move it where you want.
To find by how much the scroll view has scrolled, you can check UIScrollView's contentOffset property:
contentOffset - The point at which the origin of the content view is
offset from the origin of the scroll view.
Then to rotate that image view, you could do this:
self.imageview.transform = CGAffineTransformMakeRotation(M_PI/2);
As far as the animation goes, I personally don't have much experience with it. But you could have a look at Simple Animation Using UIImageView.
I am trying to implement zooming and panning on a 2-page UIPageViewController in landscape mode. I have set a scrollview as the view of parent viewcontroller of the pageviewcontroller. This allows the pageviewcontroller to zoom, but not to pan. Is this the correct approach to implementing zooming and panning for UIPageViewcontroller or what approach should I take please?