简体   繁体   中英

iOS 13 Adding a UIWindow with shadow

I would like to add a UIWindow with shadow and corners in iOS 13. My UIWindow looks like this:

- UIWindow
  - backgroundView
  - containerView
    - topContainerView(containers for avatar and nickname)
    - replyView
    - ......

Currently, I add corners with UIBezierPath in my containerView, and add shadow in my backgroundView. It works perfectly under iOS 12. But in iOS 13, it does not work.

Expected :

预期图像

Currently:

当前图像

Any suggestions and ideas would be appreciated.

Turns out the UIDropShadowView under iOS 13 defaults its clipsToBounds to true.

To fix this, manually set its clipsToBounds property to false.

window.subviews.first?.subviews.first?.clipsToBounds = false

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM