views:

721

answers:

1

I have drawn few shapes in drawRect function of a view, these shapes color changes after some time repeatedly using setNeedsDisplay that calls the drawRect, secondly a shape name is also to be selected when tapped on it, up till now all works fine.

There are three views each having more than one shapes drawn as above. All these views are added into a scroll view so that user can view shapes on next view.

Now the requirement is to pinch zoom the view containing shapes, also need to select the shapes, drawRect is called repeatedly. all the pinch zoom i have seen are related to images.

A: 

I have done it using the following technique. I created a class that extends from UIScrollView and it can zoom, it contains the View that has shapes. Number of these scroll views are are equal to number of views containing shapes (i.e. 3).

Now these scroll view objects are added to the main scroll view linked with page control.

The touch returns the same point after scaling as without scaling. So algo for selecting shape clicked did not change.

Ali Awais