UIScrollView can't zoom in iOS7 with Auto Layo

2019-07-09 04:19发布

i have created an UIScrollView with this hierarchy (my sample is AutoLayout)

UIViewController
  UIView
     UIScollView
       ContainerView
          UIImageView

enter image description here

everything work fine in iOS 8 - 9 expect iOS 7

i can zoom my ImageView in iOS 7

i have implemented :

-(void)viewDidLayoutSubviews
 {
[super viewDidLayoutSubviews];
CGSize scrollableSize =  CGSizeMake(self.imageView.frame.size.width,self.imageView.frame.size.height);
[self.scrollView setContentSize:scrollableSize];
self.scrollView.backgroundColor = [UIColor whiteColor]; 
self.scrollView.minimumZoomScale = 1.0  ;
self.scrollView.maximumZoomScale = 4;

  }



-(UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
 return self.containerView;
}

i have checked this links : UIScrollView zooming with Auto Layout Scroll View not functioning IOS 7

Problem

zoom not work in iOS 7 , ( i need to use Auto Layout ) and my UIImageview should have a AspectFit Ratio

i uploaded my sample on github :

sampleProject

0条回答
登录 后发表回答