【发布时间】:2015-01-24 23:32:22
【问题描述】:
我在 UIScrollView 中有一个 UIImageView,我可以垂直滚动,但不能水平滚动,因为我设置了内容大小。这正是我想要的。
但是,我似乎无法放大和缩小。我设置了最小和最大缩放比例,但它不起作用。
谁能告诉我为什么?
谢谢。
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//self.scrollView.scrollEnabled = YES;
CGSize scrollableSize = CGSizeMake(self.view.frame.size.width, self.view.frame.size.height);
[self.scrollView setContentSize:scrollableSize];
UIImageView *tempImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"test.png"] ];
tempImageView.frame = CGRectMake(0, 0, self.scrollView.frame.size.width, self.view.frame.size.height);
self.scrollView.backgroundColor = [UIColor blackColor];
self.scrollView.minimumZoomScale = 1.0 ;
self.scrollView.maximumZoomScale = tempImageView.image.size.width / self.scrollView.frame.size.width;
self.scrollView.zoomScale = 1.0;
self.scrollView.delegate = self;
[self.scrollView addSubview:tempImageView];
}
【问题讨论】:
标签: ios objective-c uiscrollview uiimageview