Podfile
pod 'TDTabView'
ViewController
class ViewController: TDTabViewController {
var vc1: UIViewController!
var vc2: UIViewController!
var vc3: UIViewController!
override func viewDidLoad() {
super.viewDidLoad()
self.delegate = self
let storyboard1 = UIStoryboard(name: "Table", bundle: nil)
vc1 = storyboard1.instantiateInitialViewController()
let storyboard2 = UIStoryboard(name: "Image", bundle: nil)
vc2 = storyboard2.instantiateInitialViewController()
let storyboard3 = UIStoryboard(name: "Web", bundle: nil)
vc3 = storyboard3.instantiateInitialViewController()
}
}
extension ViewController: TDTabViewControllerDelegate {
func viewControllers() -> [UIViewController] {
return [vc1, vc2, vc3]
}
func backgroundColor() -> UIColor? {
return UIColor(red: 50/255, green: 50/255, blue: 50/255, alpha: 0.8)
}
}
class ViewController: TDTabViewController {
Create a view controller that inherits from TDTabViewController.
extension ViewController: TDTabViewControllerDelegate {
func viewControllers() -> [UIViewController] {
return [vc1, vc2, vc3]
}
func backgroundColor() -> UIColor? {
return UIColor(red: 50/255, green: 50/255, blue: 50/255, alpha: 0.8)
}
}
Just add TDTabViewControllerDelegate and return the view controller you want to display as a tab! Very easy!
The main function was completed in one day, but I was not satisfied with the UI (although I still want to improve it), and it took about two weeks to improve the UI. .. ..
Please use it if you like! And please give me LGTM (* ยด-`)
Click here for git https://github.com/ymarui/TDTabView
end
Recommended Posts