UIScrollView can't zoom in iOS7 with Auto Layout

荒凉一梦 提交于 2019-12-12 19:18:31

问题


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

UIViewController
  UIView
     UIScollView
       ContainerView
          UIImageView

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

来源:https://stackoverflow.com/questions/33646238/uiscrollview-cant-zoom-in-ios7-with-auto-layout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!