开发者

uiimageview retain position on scrollview zoom

开发者 https://www.devze.com 2023-04-11 21:08 出处:网络
I have a scrollview with an uiimageview represented as a tiled layer, it is a static map. I have an imageview for pin over it. when the user zooms in and out of the map, I need the pi开发者_JS百科n to

I have a scrollview with an uiimageview represented as a tiled layer, it is a static map. I have an imageview for pin over it. when the user zooms in and out of the map, I need the pi开发者_JS百科n to retain its position, and also increase in size proportionately so that it is still visible at a smaller zoomscale. I can see this happening seamlessly in google maps. When you zoom out, the pin changes size at the same time. I tried implementing the scrollviewdidbeginzoom and endzooming methods, hiding the pin when the user begins zoom and putting it back at a recalculated position at the end of it. But it does not appear elegant. Any pointers would be helpful, thanks.


I solved this by taking the whole logic of adding the imageview pin to the innermost layer(TilingView in the photoscroller app). It then automatically takes care of retaining position. I change the size of the image to make it bigger at certain zoom levels.

0

精彩评论

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

关注公众号