2010-08-08 50 views
2

我在UINavigationContoller上已经推入了几个视图的2个级别。现在我正在查看其中一个推送的视图控制器中的图像,当我点击导航栏中的信息按钮时,我希望子视图翻转而保留导航栏。我怎样才能得到子视图(被推动的视图)翻转?此时导航栏也翻转并阻止我导航备份我的堆栈。翻转由UINavigationController管理的UIViewController隐藏导航栏

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

    [self.imgInfoViewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal]; 

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

} 

回答

2

代码来自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]; 
    } 
+0

感谢阿龙正是我一直在寻找。 – Jeff 2010-08-08 12:03:36