0

我试图让导航控制器的方向与它kCATransitionFromTop一致,CATransition并且它被设置为这样做但是由于某种原因它仍然是从右到左。淡入淡出部分完美运行。有什么我做错了让这个不起作用吗?我需要在另一个视图控制器中添加代码吗?谢谢

- (void)bottomButtonScreen4:(UIGestureRecognizer *)gestureRecognizer {

        settingsViewController = [[SettingsViewController alloc] init];

        CATransition* transition = [CATransition animation];
        transition.duration = 0.5;
        transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
        transition.type = kCATransitionFromTop;
        [self.navigationController.view.layer addAnimation:transition forKey:nil];
        [self.navigationController pushViewController:settingsViewController animated:YES];
    }
4

1 回答 1

0

类型应该是 push,子类型 kCATransitionFromBottom (实际上使它从顶部进入):

    CATransition* transition = [CATransition animation];
    transition.duration = 0.5;
    transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    transition.type = kCATransitionPush;
    transition.subtype = kCATransitionFromBottom;
    [self.navigationController.view.layer addAnimation:transition forKey:nil];
    [self.navigationController pushViewController:settingsViewController animated:NO];
于 2013-08-12T03:15:33.357 回答