修改了登录成功之后的tab
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
//
|
||||
// BaeTabBarViewController.swift
|
||||
// yinmeng-ios
|
||||
//
|
||||
// Created by MaiMang on 2024/2/21.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class BaeTabBarViewController: UITabBarController {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// BaeTabBarViewController.swift
|
||||
// yinmeng-ios
|
||||
//
|
||||
// Created by MaiMang on 2024/2/21.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class BaseTabBarViewController: UITabBarController {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
setupChildControllers()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private extension BaseTabBarViewController {
|
||||
func setupChildControllers() {
|
||||
let encounter: (BaseViewController, String, UIImage?, UIImage?) = (HomeVoiceVC(), "", UIImage(named: "tabbar_icon_song"), UIImage(named: "tabbar_icon_song_sel"))
|
||||
|
||||
let home: (BaseViewController, String, UIImage?, UIImage?) = (PlanetStarVC(), "", UIImage(named: "tabbar_icon_planet"), UIImage(named: "tabbar_icon_planet_sel"))
|
||||
|
||||
let message: (BaseViewController, String, UIImage?, UIImage?) = (ChatVC(), "",UIImage(named: "tabbar_icon_chat"), UIImage(named: "tabbar_icon_chat_sel"))
|
||||
|
||||
let person: (BaseViewController, String, UIImage?, UIImage?) = (UserInfoVC(), "",UIImage(named: "tabbar_icon_user"), UIImage(named: "tabbar_icon_user_sel"))
|
||||
|
||||
let controllers = [encounter, home, message, person]
|
||||
var controllerList:[BaseNavigationViewController] = []
|
||||
controllers.forEach { viewController, title, image, selectedImage in
|
||||
let nav = configVGNavigationController(viewController: viewController, title: title, image: image, selectedImage: selectedImage)
|
||||
controllerList.append(nav)
|
||||
}
|
||||
self.viewControllers = controllerList
|
||||
|
||||
}
|
||||
|
||||
func configVGNavigationController(viewController: BaseViewController, title: String?, image: UIImage?, selectedImage: UIImage?) -> BaseNavigationViewController
|
||||
{
|
||||
let navigationController = BaseNavigationViewController(rootViewController: viewController)
|
||||
viewController.navigationItem.title = title
|
||||
|
||||
let tabBarItem = UITabBarItem(title: title,
|
||||
image: image?.withRenderingMode(.alwaysOriginal),
|
||||
selectedImage: selectedImage?.withRenderingMode(.alwaysOriginal))
|
||||
self.tabBar.backgroundColor = ThemeColor(hexStr: "#1D2126")
|
||||
tabBarItem.setTitleTextAttributes([NSAttributedString.Key.foregroundColor: ThemeColor(hexStr: "#FFFFFF"), NSAttributedString.Key.font: UIFont.systemFont(ofSize: 10, weight: .bold)], for: .selected)
|
||||
tabBarItem.setTitleTextAttributes([NSAttributedString.Key.foregroundColor: ThemeColor(hexStr: "#FFFFFF"), NSAttributedString.Key.font: UIFont.systemFont(ofSize: 10 ,weight: .bold)], for: .normal)
|
||||
tabBar.unselectedItemTintColor = UIColor.white
|
||||
navigationController.tabBarItem = tabBarItem
|
||||
|
||||
return navigationController
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user