Last active
January 6, 2017 12:25
-
-
Save lukewakeford/62860fc90ef043412cd739b0914dd77b to your computer and use it in GitHub Desktop.
Tab Bar Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomTabbar:UITabBarController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let data = [ | |
1:"data", | |
2:"data", | |
3:"data", | |
4:"data" | |
] | |
var viewControllers = Array<UIViewController>() | |
for (key,value) in data { | |
let vc = CustomViewController() | |
vc.tabBarItem = UITabBarItem() // You can set the bar item here if you want, otherwise it should us defaults. | |
vc.id = key | |
vc.data = value | |
viewControllers.append(vc) | |
} | |
self.setViewControllers(viewControllers, animated: true) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment