Unwanted white background visible around a UITableView when rotating from landscape to portrait

I have a UITableView in an iPad application I'm working on. When I start looking in the portrait and turn to the landscape, the view rotates and the rotation looks good.

However, when I turn from landscape to portrait, there is a white edge that is displayed during rotation. The UITableView seems to be resized to fit the portrait display at the start of rotation. (When turning into a landscape, resizing first means that white will not be visible.)

After a few screenshots that I was able to capture, it seems that the animation order is as follows:

  • Resize UITableView
  • Run rotation animation
  • Resize UIToolbar

During the research, I found that some people suggest changing the background color of the UIWindow according to your view (blue in this case), but my real UITableView does not have a solid color background, so this method is not enough.

I would like to be able to control when the rotation of individual species occurs, so that I can prevent the visibility of this white border during rotation. Or, if there is a better approach, please share this too!

[Edit] Here's a rough screenshot showing a white frame during rotation:

enter image description here

+6
source share
1 answer

Try setting the background color of the window layer to [UIColor blackColor]

+3
source

Source: https://habr.com/ru/post/887326/


All Articles