import UIKit
class MainTabViewController: UITabBarController {
let home = HomeViewController()
let market = UIViewController()
let news = NewsViewController()
let edu = EduViewController()
let trade = UIViewController()
override func viewDidLoad() {
super.viewDidLoad()
setupBranches()
tabBar.isTranslucent = false
let naviNews = UINavigationController(rootViewController: news)
naviNews.navigationBar.isTranslucent = false
naviNews.navigationBar.barTintColor = PermanentUI.naviBarTintColor
naviNews.navigationBar.tintColor = .white
let naviEdu = UINavigationController(rootViewController: edu)
naviEdu.navigationBar.isTranslucent = false
naviEdu.navigationBar.barTintColor = PermanentUI.naviBarTintColor
naviEdu.navigationBar.tintColor = .white
let viewControllers = [home, market, naviNews, naviEdu, trade]
setViewControllers(viewControllers, animated: false)
}
private func setupBranches() {
setupHome()
setupMarket()
setupNews()
setupEdu()
setupTrade()
}
private func setupHome() {
home.tabBarItem.image = #imageLiteral(resourceName: "tab_home")
home.tabBarItem.selectedImage = #imageLiteral(resourceName: "tab_home_selected")
home.tabBarItem.title = "首页"
}
private func setupMarket() {
market.tabBarItem.image = #imageLiteral(resourceName: "tab_market")
market.tabBarItem.selectedImage = #imageLiteral(resourceName: "tab_market_selected")
market.tabBarItem.title = "行情"
}
private func setupNews() {
news.tabBarItem.image = #imageLiteral(resourceName: "tab_news")
news.tabBarItem.selectedImage = #imageLiteral(resourceName: "tab_news_selected")
news.tabBarItem.title = "咨询"
}
private func setupEdu() {
edu.tabBarItem.image = #imageLiteral(resourceName: "tab_edu")
edu.tabBarItem.selectedImage = #imageLiteral(resourceName: "tab_edu_selected")
edu.tabBarItem.title = "投教"
}
private func setupTrade() {
trade.tabBarItem.image = #imageLiteral(resourceName: "tab_trade")
trade.tabBarItem.selectedImage = #imageLiteral(resourceName: "tab_trade_selected")
trade.tabBarItem.title = "交易"
}
}
iOS MainTabViewController
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 这里强烈推荐一款好用的iOS代码混淆工具支持(oc、swift、c++、dart):Github:https://...
- 最新版本12.1 (16B91) 在Finder状态下前往文件夹,快捷键:shift+command+G,填写路径...
- 使用cocopods时遇到以下错误: CocoaPods did not set the base configu...
- 一、iOS12(Xcode10) 1.1、升级Xcode10后项目报错 不允许多个info.plist Xcode...
- 今天青石的票圈出镜率最高的,莫过于张艺谋的新片终于定档了。 一张满溢着水墨风的海报一次次的出现在票圈里,也就是老谋...