UIScrollView content view's frame's size doesn't change consistently?
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.
精彩评论