开发者

UIScrollView with two UIView's Layers (one should not be zoomed)

I want to make a thing like Maps application. I've a UIScrollView with two views:

  1. [BACKGROUND] UIView with an image (suppose a pdf page)
  2. [OBJECTS LAYER] UIView on top (always inside the UIScrollView) where I want to draw/place some objects (ie UIImageVi开发者_运维问答ews with pins like in Google Maps)

Is possible to disable zoom for my second view. [OBJECTS LAYER] should not be zoomed and objects should remain at the same position (obviously the position is re-caculcated using the zoomScale of UIScrollView) and with the same size (no zoom should be applied). How can I accomplish it?


The solution is:

  1. Place [OBJECTS LAYER] as direct child of UIScrollView

  2. Set [OBJECTS LAYER] to be auto-resizable in width/height

  3. Recalculate position of objects inside (ie.pins) using the scale (newX=oldX*scale,newY=oldY*scale).

Hope it helps :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜