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.