开发者

UIScrollView content view's frame's size doesn't change consistently?

开发者 https://www.devze.com 2023-02-26 06:08 出处:网络
It seems like when I pinch to zoom on a UIScrollView, the content view\'s frame size changes with the zoom. If the UIScrollView\'s zoom is 2, then the frame size of the content view becomes (2*width,

It seems like when I pinch to zoom on a UIScrollView, the content view's frame size changes with the zoom. If the UIScrollView's zoom is 2, then the frame size of the content view becomes (2*width, 2*height). However, when I zoom th开发者_运维百科e scroll view programmatically using -setZoomScale:animated, the content view's frame does not resize.

Does anyone know if this is normal behavior, and if so, how I can programmatically zoom while resizing the frame?

Thanks!


Yes it is a normal behavior. You need to calculate programmatically the new width and height of the scrollview. you can use

  • [yourScrollView setContentSize:CGSizeMake(yourwidth,yourheight);

and to programatically set scrolling position

  • [yourScrollView setContentOffset:CGPointMake(yourxpos,yourypos) animated:YES/NO];

Hope this helps.

0

精彩评论

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