7.4、精簡分欄控制器
import UIKit
class TabBarViewController: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = UIColor.red
// self.delegate = self
self.setUp()
}
func setUp() {
self.addChileViewControllers(UINavigationController(rootViewController: OneViewController()), "tabbar01_normal","tabbar01_selected", "首頁")
self.addChileViewControllers(UINavigationController(rootViewController: TwoViewController()), "tabbar02_normal","tabbar02_selected", "常用")
self.addChileViewControllers(UINavigationController(rootViewController: ThreeViewController()), "tabbar03_normal","tabbar03_selected", "發現")
self.addChileViewControllers(MainNavViewController(rootViewController: FourViewController()), "tabbar04_normal","tabbar04_selected", "我的")
}
func addChileViewControllers(_ childVC:UIViewController,_ imagename:String,_ selectImage:String,_ title:String) {
self.addChildViewController(childVC)
childVC.tabBarItem.image = UIImage.init(named: imagename)
childVC.tabBarItem.selectedImage = UIImage.init(named: selectImage)?.withRenderingMode(.alwaysOriginal)
UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName:UIColor.black], for: .normal)
UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.red], for: .selected)
childVC.tabBarItem.title = title
}
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.
}
*/
}
相關文章
- 迅雷精簡版 for Mac!附精簡教程!Mac
- 《鬼哭邦》IGN 7.4 分:探討生死的 JRPG
- 7.4
- word分欄怎麼設定 word設定分欄的方法
- SDN控制器OpenDaylight簡介—VecloudCloud
- C++學習之路 | PTA乙級—— 1015 德才論 (25分)(精簡)C++
- CSS網頁文字分欄CSS網頁
- 精簡版 koa 簡單實現
- Xposed原理簡介及其精簡化
- ASP.NET MVC – 控制器簡介ASP.NETMVC
- SQL-分組聚合 - 單欄位分組SQL
- 以太坊簡介(2019 精校精注版)
- 習題7.4
- SqlServer根據特定欄位分組後,對需要欄位進行分組拼接SQLServer
- select,value,pluck 欄位區分
- 極簡架構模式-前端控制器模式架構模式前端
- 最精簡使用mORMot (二)ORM
- PHP7.4 更新PHP
- PHP 7.4 新特性PHP
- PHP 7.4 前瞻:FFIPHP
- VUE-表格佈局、表格查詢、工具欄、表格、分頁欄Vue
- BIRT 如何處理橫向分欄
- pandas 分組合並欄位(qbit)
- 精簡推薦演算法演算法
- jquery主要知識點(精簡)jQuery
- 設計模式精簡圖冊設計模式
- SpringMVC原始碼分析系列(精簡)SpringMVC原始碼
- 極速精簡 Go 版 LogstashGo
- Java面試整理(精簡版)Java面試
- 極簡單欄部落格系統
- 3分鐘短文:Laravel控制器用法光速入門Laravel
- 精簡化事件:事件驅動架構的精益力量事件架構
- 華存自主控制器大容量EMMC簡介
- CentOS7.4 部署 DockerCentOSDocker
- 7.1 7.3 7.4 7.7 7.10
- 7.4日BootlLoad總結boot
- list集合根據某欄位分組
- 精簡的非同步Promise實現非同步Promise