Search code examples
iosiphoneuiviewcontrolleruinavigationcontrolleruisplitviewcontroller

iPhone X is showing a visual defect when pushing a ViewController


I am seeing a visual defect (half gray bar / dark bar) at the bottom when I push a ViewController when using a iPhone X.

This is easily reproduced when you create a project using the Master-Detail App template. (File-> New-> Project-> Master-Detail App). Then run the app on the iPhone X simulator.

I'm running Xcode 9.2 - the visual defect shows up in the iPhone X simulator and on a real iPhone X iOS 11.2.2 This visual defect does not show up on the iPhone 7 or iPhone 8.

Seems that the issue stems from the fact that the view being pushed on is inside of a UINavigationController. However, this is needed to support multitasking on an iPad.

Does anyone have a work around to get rid of this visual defect?

Sample of the defect Storyboard


Solution

  • Try this:

    self.navigationController?.navigationBar.isTranslucent = true