我正在尝试将我的 swift ui 项目中自定义 sendbird 导航栏上的标题颜色从黑色更改为白色,但尝试了所有方法后仍无法完成。我不知道这是不是...
我正在尝试将我的 swift ui 项目中自定义 sendbird 导航栏上的标题颜色从黑色更改为白色,但尝试了所有方法后还是无法完成。我不知道这是否是我覆盖代码片段的问题。非常感谢您的帮助,谢谢!
class CustomViewController: UIViewController {
var userId: String?
var hostId: String?
...
override func viewDidLoad() {
super.viewDidLoad()
// Add the channel list view controller as a child
addChild(channelListVC)
view.addSubview(channelListVC.view)
channelListVC.view.frame = view.bounds
channelListVC.didMove(toParent: self)
title = "Messages"
let skyBlueUIColor1 = UIColor(skyBlueColor.skyBlue)
// Hide the back button
navigationItem.hidesBackButton = true
NotificationCenter.default.addObserver(self, selector: #selector(handleNewChannel(_:)), name: NSNotification.Name("NewChannelCreated"), object: nil)
if let navigationBar = navigationController?.navigationBar {
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = skyBlueUIColor1
appearance.titleTextAttributes = [.foregroundColor: UIColor.white]
appearance.largeTitleTextAttributes = [.foregroundColor: UIColor.white]
navigationBar.standardAppearance = appearance
navigationBar.scrollEdgeAppearance = appearance
navigationBar.compactAppearance = appearance
navigationBar.tintColor = .white
}
// Enable large titles
navigationController?.navigationBar.prefersLargeTitles = true
navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]
}
我尝试了很多不同的方法来解决这个奇怪的问题,但仍然无法解决。 使用自定义导航栏发送用户消息