I have a scrollview in which i m showing all the imageViews from an imageArray and i have done paging enabled. Now i want to zoom in and zoom out the images in the scrollview. Can someone tel me whats the best way on doing it ??
You can-not zoom in and out of a scrollview built for paging, you can only slide between pages... you need to nest another UIScrollView within that first "paging" scroll view that is built for zooming (i.e. paging is disabled and multi-touch and zoom is enabled)
There's a WWDC 2010 video which have very nice tutorial for UIScrollView.This tutorial have very efficent techniques to do paging with zoom enable.Check this also
Related
I'am working on an iPad application which can visualise network graphs with nodes and edges. This have I accomplished by using an UIScrollView and added UIViews as subviews for the nodes and CAShapeLayer as edges. This works ok with panning and tapping on nodes and uiscrollview, but now I want to implement zooming. This is where my problems begin. How am I supposed to use the UIScrollView with multiple UIView that should zoom in or out according to pinching? How should I limit the zooming to fit the UIScrollViews content size?
I have managed to create a structure as following:
Where the View under the scrollview function as a content view.
I add subviews to the content view programmatically so it would look like:
View
Scroll View (UIScrollView)
View (UIView)
>> Node1 (UIView)
>> Node2 (UIView)
>> Node3 (UIView)
The nodes works fine and can be dragged around. The problem (just to repeat my self) is that I can't control the content view according to the uiscrollview. I have tried to implement pinch gesture which works, but jumps up every time you begin a pinch. Further I have tried to implement a pan gesture but it will only work on the scrollview not on the content view.
I hope you guys can understand my problem. If you could help me to understand the structure of the views and where I should use gestures for pinch and panning I would really appreciated.
Actually, I am begining implementing some similar graph handling visualization.
I Assume, that solution will be a little more tricky, than simply uiview with nodes.
I think, there will be some OpenGL handling panning, taping and zooming in-out. - something with SpriteKit or SceneKit, i guess. I have seen he video from WWDC 2012, 2013, or 2014 - I don`t remember, where they showed how to deal with OpenGL and scrollviews.
Or it will be scrollview only to recieve touches, and some other view to handle animation for theese touch-drag-pinch events.
I am going through the sample code (https://github.com/vfr/Reader), and tried to add the same zooming effect in all the pages at the same time. for ex: if the user increase the zoom effect in 2nd page it will set the same zoom effect in all the pages. Not getting any idea how to do this...Edit:
In Short,how to resize all the subviews of UIScrollView according to the zoomin / zoomout.
The reader you are using provides zoom in and zoom out options by default. If that doesn't work just check if you have allowed multiple touches.
I'm having problem solving how to get an effect like Duolingo's carousel scrolling of content. The effect is that the card in the middle would be the largest with ones on the sides some in and out as it
Has anyone done this or have an idea?
You can start by implementing some of the UIScrollViewDelegate methods. scrollViewDidScroll: will provide you with continuous events during the scroll and you should be able to calculate the scale of the buttons/images from this point.
I need to implement a zoomable UIPageViewController in iOS 5 when in a two pages layout mode (in other words, when the Spine Location is set to Mid).
Using a scrollview for each page works fine when only one page is displayed. But when two pages are diplayed side-by-side in landscape mode, how can one seamless synch the pages and align the borders during the zoom animation?
One possible solution would be to put the UIPageViewController inside a bigger UIScrollView controller, but this yelds a blurred image because the two scrollviews inside the pages are not updated with a higer resolution area of the source images when the parent is zoomed.
It seems that is impossible to zoom inside a UIPageViewController when in two page mode. Is there someone who found a solution to this?
Thanks in advance.
I am still testing, but I have this.
I used the pageviewcontroller template.
I changed the scene to show a image instead a month (inside a UIImageView).
used a UIPinchGestureRecognizer to zoom the image and an UIPanGestureRecognizer to move the image once it is zoomed and it works.
The only problem is sometimes the page swipe is recognised instead the pan, so it changes the page instead moving the inside image.
And it only zooms a page at a time, I marked clip subviews in the view of the dataViewController, so 2 pages remains the same size even when you zoom in the other.
I need to implement an "infinite scrolling" timeline, where the pinch-to-zoom will change the scale of the timeline rather than zoom on the underlying view, almost exactly like the scroll view of the app iStreamer (see below). I don't think I can do this with UIScrollView and am considering implementing a custom UIView that draws the timeline and its contents.
Are there any classes/formulas/constants that can provide the physics simulation behind the "glass on liquid" effect of inertial scrolling?
iStreamer (above) has overlapping touchable elements and inertial scrolling. They might be doing this with a regular UIScrollView, but I don't know how to achieve the same effect. I need to add elements that could span very wide stretches (years or decades on a timeline).
Just use a UIScrollView, and don't allow zooming on the scrollview. Instead, add a pinch gesture recognizer which implements the desired behaviour for the pinch behaviour.
Use UIGestureRecognizer as jer suggested, otherwise this might help: http://macresearch.org/dynamics-scrolling