presentModalViewController 上的不同过渡:动画: [英] Different transition on presentModalViewController:animated:

查看:17
本文介绍了presentModalViewController 上的不同过渡:动画:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我展示了一个模态视图控制器,它是一个标签栏控制器,里面有一个导航控制器.

I present a modal view controller which is a tab bar controller with a navigation controller inside it.

问题是我的第一个视图有黑色背景,我希望新视图有白色背景.

The problem is my first view has a black background and I want the new view to have a white background.

这意味着我要么必须让模态视图控制器具有透明背景(直到它在显示白色背景时完成向上滑动"动画),要么我必须将导航控制器背景设置为白色才能使它不透明.

This means I either have to have the modal view controller with a transparent background (until its completed the "slide up" animation when it shows the white background) OR I have to set the navigation controller background as white in order to make it non-transparent.

这导致我在导航栏(网络状态/电池状态/时间栏所在的位置)上方有一条额外的白色条带.我无法摆脱这个.:(

This results in me having an extra strip of white ABOVE the navigation bar (where the network status/battery status/time bar goes). I can't get rid of this. :(

因此,如果我可以将视图翻转,或淡入,或从右侧或左侧滑动,或者在美学上会更好的东西.

So if I could flip the view in, or fade it in, or slide it from the right or the left or something that would be much better asthetically.

有没有办法做到这一点?还是我只需将动画:"设置为否?

Is there any way to do this? Or will I just have to set "animated:" to NO?

谢谢

推荐答案

我不明白你在不同颜色背景下的困境是什么.视图上的不透明背景,尤其是动画背景,使应用程序运行得更快.现在关于转换,在调用 presentModalViewController 之前,插入以下行之一:

I did not understand what your plight with the different color backgrounds is about. Opaque backgrounds on your views, especially animating ones, make the app run faster. Now about transitions, before you call presentModalViewController, insert one of the following lines:

modelViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
modelViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
modelViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
modelViewController.modalTransitionStyle = UIModalTransitionStylePartialCurl;

以上任何一项都会改变过渡样式(尽管 PartialCurl 会导致最后一个视图的白色位仍然出现在顶角;它似乎没有记录,尽管它被 Maps 应用程序使用).您可能必须使用 modalTransitionStyle 设置的内容.

Any of the above will change the transition style (though the PartialCurl will result in a white bit of the last view still present in the top corner; it seems to be undocumented, though it's used by the Maps app). You may have to play with what the modalTransitionStyle gets set on.

从左侧或右侧滑入是导航控制器的一部分.使用导航控制器时,更改背景可能不是您想要的.

Sliding in from the left or right is part of the navigation controller. Changing backgrounds is probably not what you want when working with the navigation controller.

此外,无论您以哪种方式过渡,模型视图上方的额外条都会显示出来.这很烦人,但可以通过以下方式结束:

Also, that extra strip above the model view is going to show up no matter which way you transition in. It's annoying, but it can be over come as follows:

- (void)viewDidLoad {
    [super viewDidLoad];
    navigationController.view.frame = CGRectMake(0, 0, 320, 460); //<--This line
}

这篇关于presentModalViewController 上的不同过渡:动画:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆