【问题标题】:Flipping a UIViewController managed by a UINavigationController hides navigation bar翻转由 UINavigationController 管理的 UIViewController 隐藏导航栏
【发布时间】:2011-03-26 20:51:27
【问题描述】:

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

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

    [self.imgInfoViewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];

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

}

【问题讨论】:

    标签: iphone uinavigationcontroller modalviewcontroller


    【解决方案1】:

    来自 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];
        }
    

    【讨论】:

    • 谢谢 Aaron 正是我想要的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-14
    • 1970-01-01
    • 2016-09-01
    • 1970-01-01
    • 2015-07-17
    • 2011-01-21
    相关资源
    最近更新 更多