我已经在 UINavigationContoller 上降低了 2 个级别,并且已经推送了一些 View 。现在,我正在查看其中一个推送 View Controller 内的图像,当我点击导航栏中的信息按钮时,我希望 subview 翻转,将导航栏保留在原位。如何让 subview (被推送的 View )翻转?现在,导航栏也会翻转并阻止我导航回堆栈。
-(void)showImageInfo
{
self.imgInfoViewController = [[ImageInfoViewController alloc] initWithNibName:@"ImageInfoViewController" bundle:nil];
[self.imgInfoViewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self.navigationController presentModalViewController:self.imgInfoViewController animated:YES];
}
最佳答案
UICatalog 示例中的代码...我认为它会满足您的需求。基本上你必须做更多的编码才能获得翻转行为。
- (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];
}
关于iphone - 翻转由 UINavigationController 管理的 UIViewController 会隐藏导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3432996/