1

我正在使用 uitapgestures,我想要一个 uiviewcontroller 导航到另一个带有翻转动画的控制器。我尝试使用 uimodaltransitionflip,它可以工作,但下一个控制器上的按钮将无法工作。我该怎么做呢?

对于此代码,该按钮适用于其他页面。

- (void)imageView1DoubleTapped:(UITapGestureRecognizer *)gestureRecognizer
{
    GFStoryBoardViewController *gfsb = [[GFStoryBoardViewController alloc]initWithNibName:nil bundle:nil];



    [self.navigationController pushViewController:gfsb animated:YES];

}

对于此代码,该按钮在下一页上不起作用

- (void)imageView2DoubleTapped:(UITapGestureRecognizer *)gestureRecognizer
{
    SBStoryBoardViewController *sbsb = [[SBStoryBoardViewController alloc]initWithNibName:nil bundle:nil];

    sbsb.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;

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

}
4

1 回答 1

0

您需要一个根视图控制器的视图作为容器保存动画。这可以是自定义容器视图控制器或 UIWindow。(即 [UIApplication sharedApplication].window )

然后这样做:

 [UIView transitionWithView:rootViewController.view duration:0.40 options:UIViewAnimationOptionTransitionFlipFromRight animations:^
    {
        [currentViewController.view removeFromSuperView];
        //This will take up the whole screen of the container view. If using UIWindow
        //If using UIWindow, you may need to adjust to accomodate the status bar. 
        newViewController.view.frame = rootViewController.view.bounds 
        [rootViewController.view addSubView:newViewController.view];

    } completion:^(BOOL complete)
    {
         //Anything that you want to happen afterwards
    }];
于 2013-04-24T07:54:40.120 回答