RootTabBarViewController.swift
2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//
// RootTabBarViewController.swift
// ParentAssistant
//
// Created by Cao yang on 2018/4/23.
// Copyright © 2018年 HANGZHOUTEAM. All rights reserved.
//
import UIKit
class RootTabBarViewController: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
let info = Story.instantiateViewControllerWithIdentifier("InformationViewControllerVC", storyName: "Main") as! InformationViewController
let nav1 = setUpViewController(vc: info, title: "咨询频道", barImage: "")
let nav2 = setUpViewController(vc: GrowViewController(), title: "成长", barImage: "")
let my = Story.instantiateViewControllerWithIdentifier("MyViewController", storyName: "Main") as! MyViewController
let nav3 = setUpViewController(vc: my, title: "个人中心", barImage: "")
// Do any additional setup after loading the view.
self.setViewControllers([nav1,nav2,nav3], animated: true)
}
private func setUpViewController(vc:UIViewController,title:String,barImage:String)->UINavigationController{
vc.tabBarItem = UITabBarItem.init(title: title, image: UIImage.init(named: barImage), selectedImage: UIImage.init(named: barImage))
vc.configTheme()
let nav = UINavigationController.init(rootViewController: vc)
nav.navigationBar.barTintColor = navigationColor
nav.navigationBar.isTranslucent = false
navigationBarHeight = nav.navigationBar.frame.height
return nav
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}