简体   繁体   English

iphone自动旋转黑色背景

[英]iphone autorotation black background

I use OpenGLView to display content of my app but sometimes I have to display UIActionSheet. 我使用OpenGLView来显示我的应用程序的内容,但有时我必须显示UIActionSheet。 My application works on both - landscape and portrait mode - but since it's OpenGL view I handle rotation of the view by myself so to display UIActionSheet I use empty view and add actionsheet to it. 我的应用程序在横向和纵向模式下均可工作,但是由于是OpenGL视图,因此我自己处理视图的旋转,因此要显示UIActionSheet,我使用空视图并向其中添加操作表。 the problem is that when I use shouldAutorotateToInterfaceOrientation everything works well but the animation of rotation (the black background on the edges of the screen) doesn't match visually to the rest of the application. 问题是,当我使用shouldAutorotateToInterfaceOrientation时,一切正常,但是旋转动画(屏幕边缘的黑色背景)与应用程序的其余部分在视觉上不匹配。 Is there a way to change that background or turn off the animation (set it's time to 0?) but still let the OS to handle the rotation of the view? 有没有办法更改背景或关闭动画(将时间设置为0?),但仍然让OS处理视图的旋转?

I think this is what your asking, and this is what works for me: 我认为这是您的要求,这对我有用:

- (void)viewDidLoad {
    [super viewDidLoad];

    self.view.backgroundColor = [UIColor blackColor];
}

Where "blackColor" is the color you want to set the background. 其中“ blackColor”是您要设置背景的颜色。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM