翻转由 UINavigationController 管理的 UIViewController 会隐藏导航栏

发布于 2024-09-13 00:49:03 字数 526 浏览 4 评论 0原文

我已经在 UINavigationContoller 上降低了 2 个级别,并且已经推送了一些视图。现在,我正在查看其中一个推送视图控制器内的图像,当我点击导航栏中的信息按钮时,我希望子视图翻转,将导航栏保留在原位。如何让子视图(被推送的视图)翻转?现在,导航栏也会翻转并阻止我导航回堆栈。

-(void)showImageInfo
{   
    self.imgInfoViewController = [[ImageInfoViewController alloc] initWithNibName:@"ImageInfoViewController" bundle:nil];

    [self.imgInfoViewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];

    [self.navigationController presentModalViewController:self.imgInfoViewController animated:YES];

}

I'm 2 levels down on a UINavigationContoller having already pushed a few views. Now I'm looking at an image inside one of the pushed view controllers and when I tap an info button in the navigation bar, I want the sub view to flip leaving the nav bar in place. How do I get just the subview (the view that was pushed) to flip? Right now the nav bar also flips and prevents me from navigating back up my stack.

-(void)showImageInfo
{   
    self.imgInfoViewController = [[ImageInfoViewController alloc] initWithNibName:@"ImageInfoViewController" bundle:nil];

    [self.imgInfoViewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];

    [self.navigationController presentModalViewController:self.imgInfoViewController animated:YES];

}

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

俯瞰星空 2024-09-20 00:49:03

来自 UICatalog 示例的代码...我认为它会满足您的需求。基本上你必须做更多的编码才能获得翻转行为。

http://developer.apple.com/iphone/library/samplecode/UICatalog/Listings/TransitionViewController_m.html#//apple_ref/doc/uid/DTS40007710-TransitionViewController_m-DontLinkElementID_34

  - (IBAction)flipAction:(id)sender
    {
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:kTransitionDuration];

        [UIView setAnimationTransition:([self.mainView superview] ? UIViewAnimationTransitionFlipFromLeft :UIViewAnimationTransitionFlipFromRight)                                      forView:self.containerView  cache:YES];
        if ([flipToView superview])
        {
            [self.flipToView removeFromSuperview];
            [self.containerView addSubview:mainView];
        }
        else
        {
            [self.mainView removeFromSuperview];
            [self.containerView addSubview:flipToView];
        }

        [UIView commitAnimations];
    }

code from UICatalog Example.... I think it will do what you are looking for. Basically you have to do some more coding to get the flip behavior.

http://developer.apple.com/iphone/library/samplecode/UICatalog/Listings/TransitionViewController_m.html#//apple_ref/doc/uid/DTS40007710-TransitionViewController_m-DontLinkElementID_34

  - (IBAction)flipAction:(id)sender
    {
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:kTransitionDuration];

        [UIView setAnimationTransition:([self.mainView superview] ? UIViewAnimationTransitionFlipFromLeft :UIViewAnimationTransitionFlipFromRight)                                      forView:self.containerView  cache:YES];
        if ([flipToView superview])
        {
            [self.flipToView removeFromSuperview];
            [self.containerView addSubview:mainView];
        }
        else
        {
            [self.mainView removeFromSuperview];
            [self.containerView addSubview:flipToView];
        }

        [UIView commitAnimations];
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文