kitasuke / PagingMenuController

Paging view controller with customizable menu in Swift
MIT License
2.5k stars 449 forks source link

Need a MenuViewCustomizable option that can add shadow to the menu. #282

Open DesmondPang opened 7 years ago

DesmondPang commented 7 years ago

Like some Google apps' design. The shadow can separate the menu and the content view if they have same colour. Thanks you.

kitasuke commented 7 years ago

Like image below?

Here is my code for shadow. shadowColor, shadowOffset, shadowOpacity and shadowRadius will be options for that.

layer.shadowColor = UIColor.gray.cgColor
layer.shadowOffset = CGSize(width: 2, height: 2)
layer.shadowOpacity = 1
layer.shadowRadius = 0
layer.shadowPath = UIBezierPath(roundedRect: bounds, cornerRadius: 0).cgPath

simulator screen shot oct 9 2016 12 01 11

DesmondPang commented 7 years ago

I mean this kind of effect. I think you can set the view of the menu to public and then users can customise it they want through view.layer. Thank you so much.

screen shot 2016-10-22 at 2 41 24 am
fatgue commented 7 years ago

Hi,

@DesmondPang do you find a way to do this?

cody1024d commented 7 years ago

@kitasuke I believe the issue with this, is simply the order in which you're adding the views to the PagingViewController. If we were to add the pages BEFORE adding the MenuView, then anyone's app can add a shadow to the menu view (using standard code), and it would appear over the pages. Right now, because it is added before (and thus, has a lower "z-position" value), the pages appear over any shadow that is created.

I am open to making this change via a PR if you'd be willing to look at it and merge it?