Close Menu
  • Home
  • AI
  • Big Data
  • Cloud Computing
  • iOS Development
  • IoT
  • IT/ Cybersecurity
  • Tech
    • Nanotechnology
    • Green Technology
    • Apple
    • Software Development
    • Software Engineering

Subscribe to Updates

Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

    What's Hot

    Latest progress update on Microsoft’s Secure Future Initiative

    November 17, 2025

    November 17, 2025 – Tim Cook succession planning, more

    November 17, 2025

    How to Hire Offshore Software Developers

    November 17, 2025
    Facebook X (Twitter) Instagram
    Facebook X (Twitter) Instagram
    Big Tee Tech Hub
    • Home
    • AI
    • Big Data
    • Cloud Computing
    • iOS Development
    • IoT
    • IT/ Cybersecurity
    • Tech
      • Nanotechnology
      • Green Technology
      • Apple
      • Software Development
      • Software Engineering
    Big Tee Tech Hub
    Home»iOS Development»ios – View controller title color not inverting based on background
    iOS Development

    ios – View controller title color not inverting based on background

    big tee tech hubBy big tee tech hubOctober 29, 2025013 Mins Read
    Share Facebook Twitter Pinterest Copy Link LinkedIn Tumblr Email Telegram WhatsApp
    Follow Us
    Google News Flipboard
    ios – View controller title color not inverting based on background
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link


    Using Xcode 26.0.1 and running on iOS Simulator “iPad (A16)” with iOS 26.0.1.

    I am presenting a view controller as Full Screen in a navigation controller.
    It has a leftBarButtonItem, rightBarButtonItem, and a title.
    It also has an image view showing an image with a white background (the image is not full screen).

    The leftBarButtonItem’s text and background colors seem to automatically adjust based on the underlying image color and light/dark mode. The title’s text color, however, does not and only uses the system text color based on light/dark mode.

    Here is how the view controller is presented:

    @IBAction func loginPressed(_ sender: Any) {
        let lvc = LoginViewController()
        lvc.delegate = self
        let nc = UINavigationController(rootViewController: lvc)
        nc.modalPresentationStyle = .fullScreen
        self.present(nc, animated: true)
    }
    

    Here is the viewDidLoad of LoginViewController:

    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.title = "My Title"
        
        self.view.backgroundColor = .systemBackground
        
        self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Help", style: .plain, target: nil, action: nil)
        
        self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(doneTapped))
        
        let iv = UIImageView()
        iv.image = UIImage(named: "ImageWithWhiteBackground")
        iv.contentMode = .scaleAspectFit
        iv.translatesAutoresizingMaskIntoConstraints = false
        self.view.addSubview(iv)
        let wc = NSLayoutConstraint(item: iv, attribute: .width, relatedBy: .equal, toItem: self.view, attribute: .width, multiplier: 1, constant: 0)
        let hc = NSLayoutConstraint(item: iv, attribute: .height, relatedBy: .equal, toItem: self.view, attribute: .height, multiplier: 1, constant: 0)
        let xc = NSLayoutConstraint(item: iv, attribute: .centerX, relatedBy: .equal, toItem: self.view, attribute: .centerX, multiplier: 1, constant: 0)
        let yc = NSLayoutConstraint(item: iv, attribute: .centerY, relatedBy: .equal, toItem: self.view, attribute: .centerY, multiplier: 1, constant: 0)
        self.view.addConstraints([wc, hc, xc, yc])
    }
    

    This is how the view controller appears in Light Mode in Portrait and Landscape:

    LightMode Portrait Title visible

    LightMode Landscape Title visible

    The leftBarButtonItem and title text colors are dark because it’s Light Mode — everything is visible and readable.

    This is how the view controller appears in Dark Mode in Portrait and Landscape:

    DarkMode Portrait Title visible

    The leftBarButtonItem and title text colors are light because it’s Dark Mode — everything is visible and readable. The image height is less than the screen so the view controller’s view (with background color set to systemBackground) is visible at top and bottom. Notice the leftBarButtonItem is white text on a black background (for Dark Mode).

    DarkMode Landscape Title invisible

    In landscape, the image height is equal to the screen so it’s white at top and bottom.
    Notice the leftBarButtonItem is now black text on a white background (even though it’s Dark Mode).
    But the title is still white making it invisible.
    A side issue is the status bar is also invisible and unreadable.

    Is it possible to make the view controller’s title behave like the leftBarButtonItem so that it changes colors based on the underlying background?

    Or, what is the suggested or recommended solution for this?

    I also tried setting self.navigationItem.titleView to a UILabel with “My Title” but that had the same issue as using self.title.



    Source link

    background based Color Controller inverting iOS Title view
    Follow on Google News Follow on Flipboard
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Copy Link
    tonirufai
    big tee tech hub
    • Website

    Related Posts

    ios – UserDefaults doesn’t store its value

    November 16, 2025

    ios – How to implement native Tab Bar search (.searchable) for a Dictionary view in SwiftUI?

    November 15, 2025

    react native – How can I use single finger scroll reliably in iOS in ScrollList while also allowing swipe left and swipe right?

    November 14, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Editors Picks

    Latest progress update on Microsoft’s Secure Future Initiative

    November 17, 2025

    November 17, 2025 – Tim Cook succession planning, more

    November 17, 2025

    How to Hire Offshore Software Developers

    November 17, 2025

    Amazon is seeking to raise about $12B through a bond sale, its first such deal in US dollars since 2022, to help fund acquisitions, capex, and more (Bloomberg)

    November 17, 2025
    About Us
    About Us

    Welcome To big tee tech hub. Big tee tech hub is a Professional seo tools Platform. Here we will provide you only interesting content, which you will like very much. We’re dedicated to providing you the best of seo tools, with a focus on dependability and tools. We’re working to turn our passion for seo tools into a booming online website. We hope you enjoy our seo tools as much as we enjoy offering them to you.

    Don't Miss!

    Latest progress update on Microsoft’s Secure Future Initiative

    November 17, 2025

    November 17, 2025 – Tim Cook succession planning, more

    November 17, 2025

    Subscribe to Updates

    Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

      • About Us
      • Contact Us
      • Disclaimer
      • Privacy Policy
      • Terms and Conditions
      © 2025 bigteetechhub.All Right Reserved

      Type above and press Enter to search. Press Esc to cancel.