将缩放添加到scrollview

时间:2010-09-18 22:24:56

标签: iphone uiscrollview zoom

当图像位于子视图控制器中时,如何以Potrate方向向我的滚动视图添加缩放功能。在方向改变中我调用设置功能来改变

if (([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeLeft) || 
    ([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeRight)) {
    self.navigationController.navigationBarHidden = YES;
    [[UIApplication sharedApplication] setStatusBarHidden:YES];
    [self setWantsFullScreenLayout:YES];
} else {
    [[UIApplication sharedApplication] setStatusBarHidden:NO];
    [self setWantsFullScreenLayout:NO];
    self.navigationController.navigationBarHidden = NO;

    //// Zoom enable ////
}

加载控制器

for (int i=0; i < [appDelegate.inGallery count];i++) {
   ScrollViewPic *controller = [viewControllers objectAtIndex:i];
   controller = [[ScrollViewPic alloc] initWithFrame:CGRectMake(0, 0, _scrollView.bounds.size.width, _scrollView.bounds.size.height)];
   controller.svController= self;
   [viewControllers replaceObjectAtIndex:i withObject:controller];

.....

无法使用viewForZoomingInScrollView,因为图像位于其他视图控制器中。

- (UIView *)viewForZoomingInScrollView:(UIScrollView *) scrollView {return imageView; }

如何做到这一点?

0 个答案:

没有答案