jjzjj

objective-c - PresentModalViewController 与导航 Controller 中的推送 View 具有相同的动画?

coder 2024-01-27 原文

是否可以将 PresentModalViewController 与使用导航 Controller 的“pushViewController”方法时显示的相同动画一起使用?

最佳答案

据我所知,它不能水平移动。而且,当您使用 presentModalViewController:animated: 时,之前的 View 将消失(空白)。但是你可以这样做(将你想要的 View 添加到你的窗口的顶部):

UIViewController *modalViewController = [[UIViewController alloc] init];
[modalViewController.view setFrame:CGRectMake(320.0f, 0.0f, 320.0f, 480.0f)];
[modalViewController.view setBackgroundColor:[UIColor redColor]];
[[UIApplication sharedApplication].delegate.window addSubview:modalViewController.view];

[UIView animateWithDuration:0.25f
                      delay:0.0f
                    options:UIViewAnimationOptionCurveEaseInOut
                 animations:^{
                     [modalViewController.view setFrame:CGRectMake(0.0f, 0.0f, 320.0f, 480.0f)];
                 }
                 completion:nil];

[modalViewController release];

关于objective-c - PresentModalViewController 与导航 Controller 中的推送 View 具有相同的动画?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8768779/

有关objective-c - PresentModalViewController 与导航 Controller 中的推送 View 具有相同的动画?的更多相关文章

随机推荐