How to change the bottom edge color on the iPhone X programmatically?

后端 未结 2 874
再見小時候
再見小時候 2020-12-28 15:10

It changes on their native keyboard/emoji board, depending which of the two are open. I thought it would change the color automatically based on UIInputViewController<

相关标签:
2条回答
  • 2020-12-28 15:56

    One thing you can do to solve this. Change backgroundcolor of your ViewController's View for home indicator. And set status bar appearance separately through coding as per your needs.

    This will change your home indicator, status bar color plus a safe area to Chocolate color, Add separate view in safe area for your other design, as I've added yellow.

    If you want different color for your status bar, call it somewhere from viewDidLoad with color you want -

    func setStatusBarBackgroundColor(color: UIColor) {
    
            guard let statusBar = UIApplication.shared.value(forKeyPath: "statusBarWindow.statusBar") as? UIView else { return }
            statusBar.backgroundColor = color
        }  
    

    Apart from this, You won't be able to do any other changes in appearance, at least for now till apple provides any way to control appearance of home indicator. let me show you.

    These are the availability of bars, where you can control appearance of it. There is no home indicator bar option Apple has provide for it's alteration.

    These are the only bars you can control appearance -
    Navigation Bars
    Search Bars
    Status Bars
    Tab Bars
    Tool Bars

    Referral Link - iPhone-X Interface Guidelines

    0 讨论(0)
  • 2020-12-28 16:11

    If you wanna use other background color for the layout which differs with top and bottom edges, or want to keep status bar background color while switching apps, you could try to add two different views of different background color with height 50 or more (pt) in each layout nib. One constraints bottom alignment with top of the safe area, another one constraints top alignment with bottom of the safe area, and then make IBOutlet reference of these two views to set backgroundColor programmatically in code.

    0 讨论(0)
提交回复
热议问题