Search code examples
iosuiviewcontrolleruikitios11iphone-x

iPhone X hide home indicator on view controller


I have a view controller that takes up the whole screen from top to bottom. I would like to hide the home bar indicator on the bottom of the screen on iPhone X devices.

How can I do this in iOS 11?


Solution

  • You should override prefersHomeIndicatorAutoHidden in your view controller to achieve that:

    override var prefersHomeIndicatorAutoHidden: Bool {
        return true
    }