ykyouhei / KYDrawerController

Side Drawer Navigation Controller similar to Android
MIT License
621 stars 159 forks source link

how to connect to tabBarController like you example #28

Closed zj2050 closed 8 years ago

zj2050 commented 8 years ago

hi,thanks first

i want to use it with a tabBarController like this

let drawerViewController = LeftViewController()

drawerController.mainViewController = UINavigationController(
    rootViewController: configurationRootViewController()
)

drawerController.navigationController?.title = "tsing"; 
drawerController.drawerViewController = drawerViewController

/* Customize */
drawerController.drawerDirection = .Right
drawerController.drawerWidth     = 300

and the configurationRootViewController like

func configurationRootViewController() -> UITabBarController {

let todayListCtrl = UIStoryboard(name: "tsing", bundle: nil).instantiateViewControllerWithIdentifier("todaySB") as! TsingTaskController
todayListCtrl.tabBarItem.title = "today"
todayListCtrl.tabBarItem.image = UIImage(named: "tabbar_me")?.imageWithRenderingMode(.AlwaysOriginal)
todayListCtrl.tabBarItem.selectedImage = UIImage(named: "tabbar_meHL")?.imageWithRenderingMode(.AlwaysOriginal)
let todayNavigationController = UINavigationController(rootViewController: todayListCtrl)

// Create `chatsTableViewController`
let focusCtrl = UIStoryboard(name: "tsing", bundle: nil).instantiateViewControllerWithIdentifier("focusSB") as! TsingFocusController
focusCtrl.tabBarItem.title = "focus"
focusCtrl.tabBarItem.image = UIImage(named: "tabbar_discover")?.imageWithRenderingMode(.AlwaysOriginal)
focusCtrl.tabBarItem.selectedImage = UIImage(named: "tabbar_discoverHL")?.imageWithRenderingMode(.AlwaysOriginal)
let focusNavigationController = UINavigationController(rootViewController: focusCtrl)

let tabBarController = UITabBarController(nibName: nil, bundle: nil)
tabBarController.viewControllers = [todayNavigationController, focusNavigationController]

return tabBarController

} TsingTaskController , TsingFocusController are UITableViewController

the app is run, but draw is not work, can give me some point how make tabBar work, thanks

another thing , how to set drawer title ? drawerController.navigationController?.title = "tsing"; no effect

ykyouhei commented 8 years ago

@zj2050 Hi! Are you using the latest version ? In the old version , it does not work well depending on the order in which you want to customize. #26

Please as follows To set the title of the Drawer title.

drawerViewController.navigationController?.title = "tsing"
jbarros35 commented 5 years ago

it does not work at all