سؤال

I have several subviews added to a UIScrollview. Every thing works fine when swiping left and right, ie the subviews move with the swipe. When I use the pinch gestures the subviews do not zoom in and out with the other contents of the scrollview. Everything drawn in context works fine but the subviews remain the same size but move I think based on the movement of their origins, off screen for example if pinching out.

I am calling...

[scrollView setAutoresizesSubviews:YES];

on viewDidLoad. I have also called...

subView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeigh 

for each subview added.

What am I dong wrong, or is this not the way to do it?

هل كانت مفيدة؟

المحلول

Have you declared the delegate functions to resize the view when it is called ?

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView;

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView;

- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale;
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top