Black background when view rotates on orientation change

纵饮孤独 提交于 2019-12-14 02:18:33

问题


I am fiddling with an orientation change responsive app in Xcode and am trying to figure out how I can change that my non-black view seems to rotate on a black background on orientation change!

It looks something like this:

I would like to change the black background to the colour of my view - which is pink in the depicted case.

When my app launches it also shows a black screen until the actual view appears. I have the feeling that it is the same black that becomes visible on orientation change?

I have tried to change the background colour of the window in the did-finish-launching method of my app delegate, but that did not have any effect:

- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    self.window.backgroundColor = [UIColor purpleColor];

    ...
}

Any suggestions?


回答1:


Try using willAnimateRotationToInterfaceOrientation:duration: method instead of willRotateToInterfaceOrientation:duration:

But I think nearly all of the apps in iOS show a glimpse of black background, it seems normal. In your case if it is for long time, try reducing the duration time.

Also check this Stackoverflow Post



来源:https://stackoverflow.com/questions/30637776/black-background-when-view-rotates-on-orientation-change

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!