我似乎无法使用 UIViewContentModeScaleAspectFit 属性在我的滚动视图中缩放我的 imageView 以适应滚动视图的大小。
- (void)loadView {
UIImage* image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://www.moilum.com/images/atomicongallery/setmenu/setmenu1.jpg"]]];
imageView = [[UIImageView alloc]initWithImage:image];
imageView.contentMode = UIViewContentModeScaleAspectFit;
CGRect applicationFrame = [[UIScreen mainScreen] applicationFrame];
UIScrollView* scrollView = [[UIScrollView alloc]initWithFrame:applicationFrame];
[scrollView addSubview:imageView];
scrollView.contentSize = image.size;
scrollView.minimumZoomScale = 0.3;
scrollView.maximumZoomScale = 3.0;
scrollView.clipsToBounds = NO;
scrollView.delegate = self;
self.view = scrollView;
}
我也试过 imageView.contentMode = UIViewContentModeScaleAspectFill 。scrollView.contentmode = UIViewContentModeScaleAspectFill 也是如此。一切似乎都不起作用:(
有什么办法吗!?
干杯!