大视图控制器内的翻转视图控制器将翻转主视图控制器

时间:2013-04-01 13:12:17

标签: objective-c transition viewflipper flip

我想翻转尺寸小于屏幕的视图控制器。我正在使用 transitionFromViewController ,但这也会翻转整个屏幕。我想要翻转较小的视图控制器。

首先登录应该是可见的,翻转后寄存器视图应该可用!

我的代码是

- (void)showLogin {
    vcLogin = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
    [self.view addSubview:vcLogin.view];
    [self addChildViewController:vcLogin];

    if (IS_IPAD()) {
        vcLogin.view.center = self.view.center;
    }
}

- (void)showRegister {
    vcRegister = [[RegisterViewController alloc] initWithNibName:@"RegisterViewController" bundle:nil];
    [self.view addSubview:vcRegister.view];
    [self addChildViewController:vcRegister];

    if (IS_IPAD()) {
        vcRegister.view.center = self.view.center;
    }

    [vcLogin willMoveToParentViewController:nil];

    [self transitionFromViewController:vcLogin toViewController:vcRegister duration:0.5f options:UIViewAnimationOptionTransitionFlipFromLeft animations:^{} completion:^(BOOL finished) {
        [vcLogin removeFromParentViewController];
        [vcRegister didMoveToParentViewController:self];
    }];
}

我也试过 [UIView transitionFromView:...] 但结果是一样的! 有什么建议?谢谢!

1 个答案:

答案 0 :(得分:0)

你尝试过核心动画吗?您可能会使用类似下面的代码,并且有一个带有子视图的视图控制器。

    [UIView transitionFromView:viewOne
                        toView:viewTwo
                      duration:1.0f
                       options:UIViewAnimationOptionTransitionFlipFromRight | UIViewAnimationOptionShowHideTransitionViews
                    completion:(^(BOOL finished){
    })];