我有多個圖像的滾動視圖,我正在使用此代碼。我有在縱向尺寸(2121 X 2892)和(2112 1×1500)圖像在橫向模式如何放大和縮小滾動視圖上的多個圖像
scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
scrollView.pagingEnabled = YES;
scrollView.delegate = self;
scrollView.showsVerticalScrollIndicator = NO;
scrollView.showsHorizontalScrollIndicator = NO;
scrollView.maximumZoomScale = 3.0f;
scrollView.minimumZoomScale = 1.0;
NSInteger numberOfViews = [arrayImages count];
for (int i = 0; i < numberOfViews; i++)
{
CGFloat yOrigin = i * scrollView.frame.size.width;
imageView = [[UIImageView alloc]initWithFrame:CGRectMake(yOrigin +30, 0, self.view.frame.size.width-60 , self.view.frame.size.height)];
imageView.userInteractionEnabled = YES;
imageView.image = [UIImage imageNamed:[arrayImages objectAtIndex:i]];
[scrollView addSubview:imageView];
imageView.userInteractionEnabled = YES;
}
[self.view addSubview:scrollView];
我想要實現的zoomin和縮小雙標籤上的功能和用兩個手指移動。我看到很多示例應用程序,但我無法做到這一點。如果有人有自己的代碼,請與我分享。
是的,我使用相同的UIPanGestureRecogniser和圖像得到放大,但我有UIScrollView上的多個圖像,scrollView.pagingEnabled = YES; 當我滾動應用程序崩潰後的圖像。 – 2012-03-30 04:59:38
然後向我們展示崩潰。這是真正的問題嗎? – mattjgalloway 2012-03-30 08:03:27
崩潰會消失,但是當我們在縮放後旋轉設備時,圖像將無法準確顯示。它的尺寸會發生變化。 – 2012-04-03 10:08:56