用于基于导航的应用程序的翻转动画

| 如何在基于导航的应用程序中为backbarbuttonitem使用翻转动画,默认情况下,该动画会弹出我们从中导航的上一个视图?我只想将翻转动画添加到基于导航的应用程序中。     
已邀请:
        为此,您需要将默认的后退按钮替换为自定义的后退按钮。它不会是箭头按钮,因为据我所知,箭头导航按钮仅存在于私有API中。 要创建按钮,请执行以下操作:
UIBarButtonItem *customBackButton = [[UIBarButtonItem alloc] initWithTitle:@\"Back\" style:UIBarButtonItemStyleBordered target:self action:@selector(flipPopView)];

self.navigationItem.leftBarButtonItem = customBackButton;

[customBackButton release];
接下来,您需要创建
flipPopView
方法才能实际回退:
- (void)flipPopView {

    // animateView should be whichever view you want the animation to occur in.
    UIView *animateView = self.navigationController.view;

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration: 0.5];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:animateView cache:YES];

    [self.navigationController popViewControllerAnimated:NO];

    [UIView commitAnimations];

}
我基于一些类似的代码,但是对您来说可能会有所不同。如果您有任何问题,请告诉我,我会解决的。     

要回复问题请先登录注册