3

我正在尝试使用 Page Curl 动画推送视图控制器。我创建了一个有效的自定义 Segue:

- (void) perform {

UIViewController *src = (UIViewController *) self.sourceViewController;
UIViewController *dst = (UIViewController *) self.destinationViewController;    

[UIView transitionFromView:src.view
                    toView:dst.view
                  duration:0.6
                   options:UIViewAnimationOptionTransitionCurlUp
                completion:^(BOOL finished) {
                    [src.navigationController pushViewController:dst animated:NO];
                }
 ];
}

当我尝试改变卷曲的方向时,问题就来了。我尝试使用或多或少像这里描述的容器。但也无法让它工作。

- (void) perform
{
    
    UIViewController *src = (UIViewController *) self.sourceViewController;
    UIViewController *dst = (UIViewController *) self.destinationViewController;    
    
    UIView* parent = src.navigationController.view;
    UIView* containerView = [[UIView alloc] initWithFrame:parent.frame];
    
    [parent addSubview:containerView];
    containerView.transform = CGAffineTransformMakeRotation(M_PI);
    [containerView addSubview:src.view];
    src.view.transform = CGAffineTransformMakeRotation(-M_PI);
    
    [UIView transitionFromView:containerView
                        toView:dst.view
                      duration:0.6
                       options:UIViewAnimationOptionTransitionCurlUp
                    completion:^(BOOL finished) {
                        [src.navigationController pushViewController:dst animated:NO];
                    }
     ];
}

这可能吗?

谢谢。

4

0 回答 0