OONewAttanceController.swift 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. //
  2. // OONewAttanceController.swift
  3. // O2Platform
  4. //
  5. // Created by 刘振兴 on 2018/5/14.
  6. // Copyright © 2018年 zoneland. All rights reserved.
  7. //
  8. import UIKit
  9. import Promises
  10. public class OONewAttanceController: UITabBarController, UITabBarControllerDelegate {
  11. private var viewModel: OOAttandanceViewModel = {
  12. return OOAttandanceViewModel()
  13. }()
  14. public required init?(coder aDecoder: NSCoder) {
  15. super.init(coder: aDecoder)
  16. // self.tabBarItemsAttributes = OONewAttanceController.items
  17. self.viewControllers = OONewAttanceController.myViewControllers
  18. }
  19. override public func viewDidLoad() {
  20. super.viewDidLoad()
  21. }
  22. // private func commonInit(_ result:Bool){
  23. // if result == true {
  24. //// self.tabBarItemsAttributes = OONewAttanceController.items
  25. // self.viewControllers = OONewAttanceController.myViewControllers
  26. // }else{
  27. //// self.tabBarItemsAttributes = OONewAttanceController.items1
  28. // self.viewControllers = OONewAttanceController.myViewControllers1
  29. // }
  30. // }
  31. override public func didReceiveMemoryWarning() {
  32. super.didReceiveMemoryWarning()
  33. // Dispose of any resources that can be recreated.
  34. }
  35. private static let myViewControllers: [UIViewController] = {
  36. //打卡
  37. if let value = StandDefaultUtil.share.userDefaultGetValue(key: O2.O2_Attendance_version_key) as? Bool, value == true {
  38. let vc1 = OOAttendanceCheckInNewController(nibName: "OOAttendanceCheckInNewController", bundle: nil)
  39. vc1.tabBarItem = UITabBarItem(title: "打卡", image: UIImage(named: "icon_daka_nor"), selectedImage: O2ThemeManager.image(for: "Icon.at_daka")!)
  40. let vc2 = OOAttanceTotalController(nibName: "OOAttanceTotalController", bundle: nil)
  41. // let nav2 = ZLNavigationController(rootViewController: vc2)
  42. vc2.tabBarItem = UITabBarItem(title: "统计", image: UIImage(named: "icon_tongji_nor"), selectedImage: O2ThemeManager.image(for: "Icon.at_tongji")!)
  43. //设置
  44. let vc3 = OOAttanceSettingController(nibName: "OOAttanceSettingController", bundle: nil)
  45. // let nav3 = ZLNavigationController(rootViewController: vc3)
  46. vc3.tabBarItem = UITabBarItem(title: "设置", image: UIImage(named: "icon_setup_nor"), selectedImage: O2ThemeManager.image(for: "Icon.at_setting")!)
  47. return [vc1, vc2, vc3]
  48. } else {
  49. let vc1 = OOAttanceCheckInController(nibName: "OOAttanceCheckInController", bundle: nil)
  50. // let nav1 = ZLNavigationController(rootViewController: vc1)
  51. vc1.tabBarItem = UITabBarItem(title: "打卡", image: UIImage(named: "icon_daka_nor"), selectedImage: O2ThemeManager.image(for: "Icon.at_daka")!)
  52. //统计
  53. let vc2 = OOAttanceTotalController(nibName: "OOAttanceTotalController", bundle: nil)
  54. // let nav2 = ZLNavigationController(rootViewController: vc2)
  55. vc2.tabBarItem = UITabBarItem(title: "统计", image: UIImage(named: "icon_tongji_nor"), selectedImage: O2ThemeManager.image(for: "Icon.at_tongji")!)
  56. //设置
  57. let vc3 = OOAttanceSettingController(nibName: "OOAttanceSettingController", bundle: nil)
  58. // let nav3 = ZLNavigationController(rootViewController: vc3)
  59. vc3.tabBarItem = UITabBarItem(title: "设置", image: UIImage(named: "icon_setup_nor"), selectedImage: O2ThemeManager.image(for: "Icon.at_setting")!)
  60. return [vc1, vc2, vc3]
  61. }
  62. }()
  63. // private static let myViewControllers1: [UIViewController] = {
  64. // //打卡
  65. // let vc1 = OOAttanceCheckInController(nibName: "OOAttanceCheckInController", bundle: nil)
  66. // let nav1 = ZLNavigationController(rootViewController: vc1)
  67. // nav1.tabBarItem = UITabBarItem(title: "打卡", image: UIImage(named: "icon_daka_nor"), selectedImage: O2ThemeManager.image(for: "Icon.at_daka")!)
  68. // //统计
  69. // let vc2 = OOAttanceTotalController(nibName: "OOAttanceTotalController", bundle: nil)
  70. // let nav2 = ZLNavigationController(rootViewController: vc2)
  71. // nav2.tabBarItem = UITabBarItem(title: "统计", image: UIImage(named: "icon_tongji_nor"), selectedImage: O2ThemeManager.image(for: "Icon.at_tongji")!)
  72. // return [nav1,nav2]
  73. // }()
  74. //
  75. public func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController) {
  76. }
  77. }