Missing Shadow for Top View from side separating menu and main view controllers
Closed this issue · 11 comments
Couldn't set shadow for top view from side between Main view and Menu view.
Update to the latest.
Just in case somebody comes across this - for me just updating to the latest wasn't enough, i had to set the shadowPath of the view that was being presented.
This may be because i am presenting all my viewcontrollers inside another UINavigationController (without the shadowPath my shadow was below the navigationbar of the UINavigationController presented by SideMenu).
The latest code puts shadows on the highest container view controller.
I had the same issue on version 6.4.2 and added shadow manually
@jonkykong already updated but it doesn't show the shadow so i have added the shadow manually.
I need more information. Can one of you investigate? I don't know how your project is organized. When I tested this on the Example project, it works as expected.
SideMenu finds the largest containing ViewController, turns off clipsToBounds
and applies the shadows. You'll have to inspect the view hierarchy to figure out what had the shadow applied to it and what is preventing it from being shown.
@jonkykong This is what my storyboard looks like
And this is what my code looks like
// I call setupSideMenu() in viewDidLoad()
private func setupSideMenu() {
SideMenuManager.default.leftMenuNavigationController = storyboard!.instantiateViewController(withIdentifier: String(describing: MenuViewController.self)) as? SideMenuNavigationController
SideMenuManager.default.addPanGestureToPresent(toView: self.navigationController!.navigationBar)
SideMenuManager.default.addScreenEdgePanGesturesToPresent(toView: self.navigationController!.view, forMenu: .left)
SideMenuManager.default.leftMenuNavigationController!.settings = makeSettings()
}
private func makeSettings() -> SideMenuSettings {
var presentationStyle = SideMenuPresentationStyle()
presentationStyle = .viewSlideOutMenuIn
presentationStyle.backgroundColor = .clear
presentationStyle.onTopShadowOpacity = 0.5
presentationStyle.onTopShadowRadius = 5
presentationStyle.onTopShadowColor = .black
var settings = SideMenuSettings()
settings.presentationStyle = presentationStyle
settings.menuWidth = traitCollection.isIphone ? view.bounds.width - 60 : 350
return settings
}
For the presentation style you've chosen, the shadow is applied to the main view controller, not the side menu as the main view controller is top most per the style.
presentationStyle.menuOnTop = true
I thought we were talking about the shadow itself not the direction of it. The shadow is still not visible without these lines:
presentationStyle.onTopShadowOpacity = 0.5
presentationStyle.onTopShadowRadius = 5
presentationStyle.onTopShadowColor = .black
Anyway, thanks for the great work, man. Best sidemenu i have seen so far!
@sercanorhangazi Can you please tell me where and how to access presentationStyle.
@KING5399 you can see it on my previous reply, the one with an image and a chunk of code. (makeSettings() -> SideMenuSettings
)