Reputation: 1
I am trying to change the color of my title on my custom sendbird navigation bar on my swift ui project to white from black but after trying everything I cannot get it done. I don't know if this is an issue of me overwriting pieces of code. Any Help much appreciated, thank you!
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]
}
I tried many different ways of fixing this weird issue but still can't get it done.sendbird user messages with custom nav bar
Upvotes: 0
Views: 37