Change color behind app on rotation

后端 未结 4 1542
隐瞒了意图╮
隐瞒了意图╮ 2021-01-06 04:54

When an iOS app rotates it will reveal a black background when the app is between portrait and landscape. Is it possible to change this color from the default black to white

4条回答
  •  Happy的楠姐
    2021-01-06 05:32

    You can do this way: enter image description here

    Add a UIViewController and set it as initial VC (in screenshot it is MainVC).
    Add two UIViewContainer: first for holding your background view , and second for your other vcs.
    Override viewDidLayoutSubviews in implementation file of background VC (in this case the .m file of red VC)

    - (void)viewDidLayoutSubviews
    {
        [super viewDidLayoutSubviews];
    
        //Some hardcode :)
        self.view.frame = CGRectMake(-100, -100, 1136, 1136);
    }
    

    After doing this you will have something like this:

    enter image description here

    I know this is not the best solution, but you can do this way until you find the best one.

提交回复
热议问题