我对一张效果很好的图片进行了缩放。它只是不会滚动。
有一件事要提一下,我尝试将图片居中,但这也不起作用。下面是我的代码。
- (void)viewDidLoad
{
[super viewDidLoad];
UIImage * image = [UIImage imageNamed:@"family.jpeg"];
self.imageview = [[UIImageView alloc] initWithImage:image];
[self.view addSubview:self.imageview];
[image drawInRect:CGRectMake((self.view.frame.size.width/2) - (image.size.width/2), (self.view.frame.size.height / 2) - (image.size.height / 2), image.size.width, image.size.height)];
[self.scroller setContentSize:[image size]];
[self.scroller setMaximumZoomScale:2.0];
}
- (UIView *)viewForZoomingInScrollView:(UIScrollView*)scrollView
{
return self.imageview;
}
非常感谢您提供的任何帮助/评论: