我有一个带有4个选项卡的选项卡应用程序和一个连接到其中的导航条。在带有导航栏的选项卡上,我有一个按钮将您带到一个新页面。我也有一个把你带回标签页,但我有一个问题。当返回到选项卡页面时,动画将以扭曲的方式进行。我所有这些都是用故事板做的,所以没有编码。我环顾四周,想把它写进代码中:
- (void) pushController: (UIViewController*) controller
withTransition: (UIViewAnimationTransition) transition
{
[UIView beginAnimations:nil context:NULL];
[self pushViewController:controller animated:NO];
[UIView setAnimationDuration:.5];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationTransition:transition forView:self.view cache:YES];
[UIView commitAnimations];
}但我不知道该怎么把它放哪。
发布于 2013-07-26 02:29:42
看看这个创建自定义segue的Apple指南。您的执行代码如下所示:
- (void)perform {
[UIView beginAnimations:nil context:NULL];
[self.sourceViewController.navigationController pushViewController:self.destinationViewController animated:NO];
[UIView setAnimationDuration:.5];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationTransition:transition forView:self.view cache:YES];
[UIView commitAnimations];
}然后,在故事板中,将segue的类型设置为Custom,然后输入自定义segue类的名称。
https://stackoverflow.com/questions/17869214
复制相似问题