presentViewController黑色背景而不是透明 [英] presentViewController black background instead of transparent
问题描述
我认为我希望以标准方式呈现给用户(从屏幕底部向上滑动)。大约一半的视图是透明背景,下半部分有一些输入字段(想象键盘弹出的方式)。当我在rootViewController上调用 [self presentViewController]
时,它会向上滑动视图,但是大约半秒之后,视图过去是透明的,它将被替换为黑色代替。这与presentViewController和presentModalViewController都会发生。如何改变这种行为?
I have a view that I wish to present to the user in the standard way (sliding up from the bottom of the screen). About half this view is a transparent background and the bottom half has some input fields (imagine the way the keyboard pops up). When I call [self presentViewController]
on the rootViewController, it slides the view up, but then about half a second later, where the view used to be transparent it is replaced with black instead. This happens with both presentViewController and presentModalViewController. How to change this behaviour?
推荐答案
最后,它看起来不可能是透明的,我是通过将此视图添加为根视图控制器边界之外的子视图,然后使用动画块将其滑动到位来解决此问题。不是很多额外的代码,但能够使用标准的iOS行为来做它会很不错。
In the end, it looks like it's not possible for it to be transparent, I've got around this by adding this view as a subview outside of the bounds of the root view controller, and then slid it into place using an animation block. Not a lot of extra code, but it would have been nice to be able to use standard iOS behaviour to do it.
这篇关于presentViewController黑色背景而不是透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!