有我的 .m 代码。
#import "ScrollZoomViewController.h"
@interface ScrollZoomViewController () <UIScrollViewDelegate>
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;
@end
@implementation ScrollZoomViewController
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
NSLog(@"zooming");
return self.imageView;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.scrollView.minimumZoomScale = 0.5f;
self.scrollView.maximumZoomScale = 5.0f;
self.scrollView.delegate = self;
self.imageView.frame = CGRectMake(0, 0, self.imageView.image.size.width, self.imageView.image.size.height);
self.scrollView.contentSize = self.imageView.image.size;
}
我正在使用 Xcode 4.5 和 iOS 6.0 并且 AutoLayout 已关闭。
图片可以滚动但不能缩放。这是因为iOS 6吗?