I have read the guidelines for contributing and I understand
I raised a question on stack overflow and got no answers.
https://stackoverflow.com/questions/61457736/jonkykong-sidemenu-presentationstyle-stopped-working-after-upgrade-to-6-4-8
The demo seems to work however it instantiates the controllers in code where as my app binds the controllers from the storyboard as per the instructions in the README. I think this subtle difference maybe affecting the result.
Describe the bug
I have the below code in my app and after upgrading to 6.4.8 it no longer takes effect. Instead the app uses the default viewSlideOut presentation style.
class SideMenuViewController: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Config options for the Slide in side menu
SideMenuManager.default.leftMenuNavigationController?.presentationStyle = .menuSlideIn
SideMenuManager.default.leftMenuNavigationController?.presentationStyle.onTopShadowOpacity = 1
.....
I have also tried the following with no change.
SideMenuManager.default.leftMenuNavigationController?.settings.presentationStyle = .menuSlideIn
SideMenuManager.default.leftMenuNavigationController?.settings.presentationStyle.onTopShadowOpacity = 1
Finally I also tried moving this to the AppDelegate but also no change.
To Reproduce
See above code.
Expected behavior
menuSlideIn presentation style instead of viewSlideOut
Screenshots
N/A
Additional context
I tried rolling back to 6.4.0 however doing so results in circular reference errors in xcode.
I am at a stale mate, any assistance would be appreciated.
I'm facing this problem too.
More specifically,
When running with the simulator, the animation style working fine and I got the expected behavior (menu slide in style)
But when running with real device I only got the menu slide out style
So I just did a further test and the result is:
iPhone6: Work perfectly no flaw
iPhone XS MAX: the slide in animation become slide out
So this is a spec problems?
So I set the setting of SideMenu NavigationController 1 more time before present it and everything is fine
Thanks @nghiepvth.
It doesn't seem to matter what I do or which version of the simulator I use I can never get the presentation style to take effect.
I am setting the presentation style in the viewDidLoad of the root view controller for the SideMenuNavigationController. This used to work but no longer works as of 6.4.8.
Can you please provide more details or sample code on how your setting this? Are you subclassing the SideMenuNavigationController? Are you a new user of this component or did this break for you too?
I had same issue and solved it by setting presentationStyle in SideMenuSettings and assign it to SideMenuNavigationController .
`func makeSettings() -> SideMenuSettings{
var settings = SideMenuSettings()
settings.allowPushOfSameClassTwice = false
settings.presentationStyle = .menuSlideIn
settings.statusBarEndAlpha = 0
return settings
}
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
guard let sideMenuNavigationController = segue.destination as? SideMenuNavigationController else { return }
sideMenuNavigationController.settings = makeSettings()
}`
thanks @ajithkumark771, your solution solved the problem for me to. Hopefully the author updates the docs.
@bludginozzie this is not a bug, but in fact how the life-cycle events are called by Apple. If you set the presentationStyle during viewDidLoad it is too late as it is after the transition has already initiated.
Two alternative solutions:
presentationStyle during the initialization of your SideMenu, not viewDidLoad:class SideMenuTableViewController: UITableViewController {
required init?(coder: NSCoder) {
super.init(coder: coder)
setup()
}
private func setup() {
guard let sideMenuNavigationController = navigationController as? SideMenuNavigationController else { return }
sideMenuNavigationController.presentationStyle = .menuSlideIn
}
// ...
}
presentationStyle/settings in prepareForSegue like the demo project does:class MainViewController: UIViewController {
// ...
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
guard let sideMenuNavigationController = segue.destination as? SideMenuNavigationController else { return }
sideMenuNavigationController.settings = makeSettings()
}
// ...
I do not explicitly state that this should be done in viewDidLoad; however I do specify settings at the time of initialization of SideMenu.
Most helpful comment
I had same issue and solved it by setting presentationStyle in SideMenuSettings and assign it to SideMenuNavigationController .