I'm not sure if im making things wrong but I've problems with combining these components. Since there are not much documentation about these, i'm trying example projects.
One the issues i have is //(navigationDrawerController?.rootViewController as? ToolbarController)?.transition(to: ProfileViewController(), completion: closeNavigationDrawer) this does not make backbutton show up. Not sure what im doing wrong.
```swift
let pageTabBarController = AppPageTabbarController(viewControllers: [NewsViewController(), TransferVC(), DailySummaryVC()])
let toolbarController = AppToolbarController(rootViewController: pageTabBarController)
let leftViewController = MenuController()
window?.rootViewController = AppNavigationDrawerController(rootViewController: toolbarController, leftViewController: leftViewController)
````
Hey @mzgnr, to get a back button you need to use a NavigationController, not ToolbarController. So it would look like this:
let pageTabBarController = AppPageTabbarController(viewControllers: [NewsViewController(), TransferVC(), DailySummaryVC()])
let navigationController = AppNavigationController(rootViewController: pageTabBarController)
let leftViewController = MenuController()
window?.rootViewController = AppNavigationDrawerController(rootViewController: navigationController, leftViewController: leftViewController)
And you would call a transition like so:
closeNavigationDrawer()
(navigationDrawerController?.rootViewController as? NavigationController)?.pushViewController(pageTabBarController, animated: true)
You might need to tweak this a bit, but this is the general idea.
If you need any further help, reopen the issue :) Or go to Material Gitter
@danieldahan thanks for the response. I think i tried this before but i got blank/white screen for some reason. Dont know what tweaks should i make 馃槩
Make a sample project that shows a blank screen using this setup and we can go from there :)
@danieldahan i think problem is my code. thanks for the help.
No worries. You should still send over a project if it is not working. I can take a look and confirm why, if it is related to Material.
@danieldahan it might be silly question but ill ask it any way 馃槃
let pageTabBarController = AppPageTabbarController(viewControllers: [NewsViewController(), TransferVC(), DailySummaryVC()])
let navigationController = AppNavigationController(rootViewController: pageTabBarController)
let leftViewController = MenuController()
this approach is not reusable and kinda ugly. Can I make just one class and call it anywhere where its needed ?
Yeah of course @mzgnr :)
So i have to put everything needed in AppNavigationDrawerController class O_O
@danieldahan since i was not sure if this is related to this framework, im asking in this comment. The confusing thing is, viewWillAppear viewdidAppear called before view actually appears on device O_O Why ?
@mzgnr Well viewWillAppear will always be called before the final render to screen, and viewDidAppear I believe coordinates with the final render to screen. Are you only seeing this in certain situations?
@danieldahan viewWillAppear was a mistake of mine. But viewDidAppear always called when app launches. It called secondly when i select it from TabbarController.
Well it is only ever called when the viewDidAppear. So it sounds correct. I am not understanding where the issue is. Please expand on your thoughts about this :)
Oh my English is not great and im missing some points 馃槅 Take a look at your first comment to my issue here. DailySummaryVC is the last view controller and NewsViewController is the first one in TabBarController. When app launches DailySummaryVC's viewDidAppear is triggered.
No worries, what version of Material are yo using that you have TabBarController in the code base?
`
import UIKit
import Material
class AppPageTabBarController: TabsController {
fileprivate var menuButton: IconButton!
fileprivate var calendarButton: IconButton!
open override func prepare() {
super.prepare()
preparePageTabBar()
prepareNavigationItem()
}
}
extension AppPageTabBarController {
fileprivate func preparePageTabBar() {
tabBar.backgroundColor = UIColor(red:0.13, green:0.13, blue:0.13, alpha:1.0)
tabBar.height = 60
tabBar.lineColor = UIColor(red:1.00, green:0.83, blue:0.04, alpha:1.0)
tabBar.dividerThickness = 0
}
func handleMenuButton() {
self.navigationDrawerController?.toggleLeftView()
}
fileprivate func prepareNavigationItem() {
let logo = UIImage(named: "demarkesportslogo")
let imageView = UIImageView(image:logo)
imageView.contentMode = .center
navigationItem.centerViews = [imageView]
let gridIcon = UIImage(named: "grid")
let calendarIcon = UIImage(named: "calendar")
menuButton = IconButton(image: gridIcon, tintColor: .black)
menuButton.addTarget(self, action: #selector(handleMenuButton), for: .touchUpInside)
calendarButton = IconButton(image: calendarIcon, tintColor: .black)
navigationItem.leftViews = [menuButton]
navigationItem.rightViews = [calendarButton]
}
}
`
Material version is 2.8.0
If you are basing your work off the samples, all should be fine. Feel free to share a sample project with me, so I can better understand and help with your issue. Also, we should move this to the Material GItter channel :)