0
votes

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:

enter image description here

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.

1

1 Answers

0
votes

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.