52inc / Pulley

A library to imitate the iOS 10 Maps UI.
https://cocoapods.org/pods/Pulley
MIT License
2.02k stars 265 forks source link

Is there any way to apply corner radius to only one side? #418

Closed rfaran closed 3 years ago

rfaran commented 3 years ago

I actually wanted to customize the Pulley in such a way that the corner radius is only applied to one side.

maskedCorners doesn't seem to work for me.

Another approach is to have a custom view on top but then the background of primary view is not shown.

amyleecodes commented 3 years ago

Configure a mask on your drawerContentViewController’s view.layer.mask property and Pulley will use that instead of its own corner rounding.

rfaran commented 3 years ago

Thanks a lot. Adding below code in drawerPositionDidChange worked.


            let path = UIBezierPath(roundedRect:drawer.drawerContentViewController.view.bounds,
                                    byRoundingCorners:[.topLeft],
                                    cornerRadii: CGSize(width: 50, height:  50))
            let maskLayer = CAShapeLayer()
            maskLayer.path = path.cgPath

            drawer.drawerContentViewController.view.layer.mask = maskLayer