自定义Segue与页面卷曲和自定义方向

时间:2013-02-22 10:15:00

标签: ios objective-c uistoryboardsegue

我正在尝试使用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];
                }
 ];
}

当我尝试改变卷曲的方向时出现问题。我尝试使用或多或少像描述here的容器。但也无法让它发挥作用。

- (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];
                    }
     ];
}

这有可能吗?

感谢。

0 个答案:

没有答案