我已经在UINavigationContoller上下了2级,已经推了几个视图。现在我正在查看其中一个推出的视图控制器中的图像,当我点击导航栏中的信息按钮时,我希望子视图翻转,使导航栏保持原位。如何才能获得翻转的子视图(被推动的视图)?现在,导航栏也会翻转并阻止我在堆栈中导航。
-(void)showImageInfo
{
self.imgInfoViewController = [[ImageInfoViewController alloc] initWithNibName:@"ImageInfoViewController" bundle:nil];
[self.imgInfoViewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self.navigationController presentModalViewController:self.imgInfoViewController animated:YES];
}
答案 0 :(得分:2)
来自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];
}