添加缩放到滚动视图

发布于 2024-09-24 04:21:17 字数 1214 浏览 1 评论 0原文

当图像位于子视图控制器中时,如何以 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; }

这怎么能做到呢?

How can i add a zoom function to my scrollview in Potrate orientation, when the images are in an subview controllers. in orientation change i call a setup function to change

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 ////
}

to load controllers

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];

.....

Cant use viewForZoomingInScrollView because the images are in an other viewcontroller.

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

How can this be done?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文