iosuiviewcontrollerios13

iOS 13 UIViewController modal presentation shadow


I have modaly presented view controller in iOS >=13. Root view has clear background:

view.backgroundColor = .clear

Child view with white background has some top offset like this:

enter image description here

All is ok, but when I try to dismiss it by swipe down I see slightly visible shadow of presented view controller:

enter image description here

Is it posible to remove this shadow on modal presentation?


Solution

  • UPDATE: Upon further investigation, this does not appear to be something that can be changed. It's a private UIKit View setup by iOS and is a new addition in iOS 13. See 19:50 at https://developer.apple.com/videos/play/wwdc2019/224/

    For my own apps/games I'll be looking to create a custom UIModalPresentationStyle to achieve the look I want.

    You can also alleviate from this by simply presenting as .fullScreen or another presentation style instead of this new sheet method.


    I have been trying to find the answer to this myself. So far I have only found that by setting the layer.shadowColor to clear it fixes this but only on iPhone. I cannot find how to fix this on iPad. override func viewDidLoad() { view.layer.shadowColor = UIColor.clear.cgColor }