Closed MohsinN closed 8 years ago
Hi,
Thank you :)
We will put an example together.
Hi,
Thanks, i did make a work around for it.
After clicking on the button in Side nav, you can invoke the function in the main controller which can perform segue/ transition. Like this the stack for Navigation bar is maintained without any extra configuration.
Dont know if it is the best alternate but awaiting to hear a better solution as this approach can create a lot of clutter if there are many screens that have a side bar nav on them.
Cheers,
And also i had to add Navigation Controller as my main controller in the app delegate. This resulted in side navigation showing the in all the screens. So i had to explicitly disable it on specific screens where it was not needed.
Adding it as the rootViewController, and then disabling where and when you want to, is perfectly fine and recommended, rather than having it deep in the view hierarchy, since they are off screen animations that are meant to be global.
I am going to be working on a MaterialNavigationViewController so that you do not need to do work arounds and such. Their will be a recommended method of doing this.
If you don't mind, would you be able to share your code? Thank you!
I don't know what the proper way is but here it goes.
In AppDelegate.swift
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
// Get view controllers from storyboard
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let mainViewController = storyboard.instantiateViewControllerWithIdentifier("NavigationController") as! NavigationController
let sideViewController = storyboard.instantiateViewControllerWithIdentifier("SideNavViewController") as! SideNavViewController
// Configure the window with the SideNavigationViewController as the root view controller
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.rootViewController = SideNavigationViewController(mainViewController: mainViewController, rightViewController: sideViewController)
window?.makeKeyAndVisible()
return true
}
Here the embedded UINavgationController is used, NavigationController is the the class used for referencing from storyboard. The basically makes the side nav visible through out the app.
In order to disable side navigation bar in each i used the following function.
func EnableSideNavigationBar(let enable: Bool){
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
if let sideBar: SideNavigationViewController = appDelegate.window?.rootViewController as! SideNavigationViewController{
sideBar.enabledRightView = enable
}
}
Performing segue directly from the side navigation bar resulted in disappearing of the navigation bar. I could not find a plausible explanation or alternate for it. So i had to call the func of the active uicontroller to perform segue. This resulted in proper handling of navigation stack.
I had six screen on which there was side nav, one way was to add segues from each screen to another that created a lot of clutter. So i ended up using the segues currently present from main menu to all six others. It was surprising to me that you can use the segues of the screen that is not visible, i could not find reason for it in documentation or maybe just i am new to this.
Also i would love to contribute to the project, please let me know if i can help in any manner.
In release 1.36.0, which will be done later today, this is fixed. We added support for the NavigationController and the example App demonstrates this. :) Thank you!
Thanks, really appreciate it. Also i would really like to contribute to the project. please let me know if there are any possibilities.
Yes that sounds great :) what kind of work do you like to do?
I will be honest, i am new to swift but i have a knack for problem solving and in love with material design. I am open to anything so hoping if you could point me in the right direction or a starting point.
I think a great start would be to make some examples that help educate people on how to use Material. This would also help me see your Swift code :)
Also, let's move the conversation to Gitter, https://gitter.im/CosmicMind/Material
Hi,
Awesome library.
Just wanted know how to perform segue while using navgationViewController. After performing segue from the side bar navigation, the navigation bar disappears.
Cheers, Mohsin