SSASideMenu icon indicating copy to clipboard operation
SSASideMenu copied to clipboard

Shadow issue in Swift 4 iOS 11 simulator

Open ankitbansal806 opened this issue 8 years ago • 1 comments

Shadow issue in Swift 4 iOS 11 simulator. Please give me the solution to remove this issue. screen shot 2017-07-26 at 4 03 46 pm

ankitbansal806 avatar Jul 26 '17 10:07 ankitbansal806

@ankitbansal806 , I got the same issue(for the new iphone X, XS, XS Max and XR). I have resolved this issue by updating method setupContentViewShadow() in the SSASideMenu's code.

the new code is as:

fileprivate func setupContentViewShadow() {
        if contentViewShadowEnabled {
            let safeAreaInsets = UIApplication.shared.keyWindow?.safeAreaInsets
            var heightToUse = safeAreaInsets?.top ?? 20.0;
            if heightToUse == 0{
                heightToUse = 20.0;
            }
            let layer: CALayer = contentViewContainer.layer
            let path: UIBezierPath = UIBezierPath(rect: CGRect(x: layer.bounds.x, y: layer.bounds.y+heightToUse, width: layer.bounds.width, height: layer.bounds.height-heightToUse))
            layer.shadowPath = path.cgPath
            layer.shadowColor = contentViewShadowColor.cgColor
            layer.shadowOffset = contentViewShadowOffset
            layer.shadowOpacity = contentViewShadowOpacity
            layer.shadowRadius = CGFloat(contentViewShadowRadius)
        }
    }

Mehul18292 avatar Jul 17 '19 09:07 Mehul18292