presentModalViewController上的不同转换:动画: [英] Different transition on presentModalViewController:animated:

查看:130
本文介绍了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.

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

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.

有没有办法做到这一点?或者我只需要将动画:设置为NO?

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;

An上面的y将改变过渡样式(尽管PartialCurl将导致最后一个视图的白色位仍然出现在顶角;它似乎没有文档,虽然它被地图应用程序使用)。您可能必须使用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.

此外,无论您转换到哪种方式,模型视图上方的额外条带都会显示出来in。这很烦人,但它可以如下:

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天全站免登陆