Close Menu
geekfence.comgeekfence.com
    What's Hot

    APple’s future success with smart glasses depends on privacy – Computerworld

    July 27, 2026

    2022 IEEE President K.J. Ray Liu Honored for Leadership

    July 27, 2026

    How lasers could help provide fuel for nuclear reactors

    July 27, 2026
    Facebook X (Twitter) Instagram
    • About Us
    • Contact Us
    Facebook Instagram
    geekfence.comgeekfence.com
    • Home
    • UK Tech News
    • AI
    • Big Data
    • Cyber Security
      • Cloud Computing
      • iOS Development
    • IoT
    • Mobile
    • Software
      • Software Development
      • Software Engineering
    • Technology
      • Green Technology
      • Nanotechnology
    • Telecom
    geekfence.comgeekfence.com
    Home»iOS Development»uitabbarcontroller – UITabBar unselectedItemTintColor ignored iOS 26
    iOS Development

    uitabbarcontroller – UITabBar unselectedItemTintColor ignored iOS 26

    AdminBy AdminJune 27, 2026No Comments3 Mins Read20 Views
    Facebook Twitter Pinterest LinkedIn Telegram Tumblr Email
    uitabbarcontroller – UITabBar unselectedItemTintColor ignored iOS 26
    Share
    Facebook Twitter LinkedIn Pinterest Email


    I’m creating a UITabBarController programmatically with a few tabs, but for some reason I can not get the normal state of the tabs icons or text to change color. Its defaulting to a system white. I can only modify the selected state.

    I’ve tried creating the tabs in multiple ways, but all seem to return the same result. The only thing I’ve managed to work around is by forcing the icons (which are templates) to render as originals after tinting them. This only works for the icons, leaving the text in the system white color, so i’ve disabled it as it looks worse to have one of each

    private func configureTabs() {
        let inbox = InboxViewController()
        inbox.tabBarItem = UITabBarItem(
            title: "INBOX",
            //image: UIImage(named: "tab-inbox")?.withTintColor(AppColors.t3, renderingMode: .alwaysOriginal),
            //selectedImage: UIImage(named: "tab-inbox")?.withTintColor(AppColors.t1, renderingMode: .alwaysOriginal)
            image: UIImage(named: "tab-inbox"),
            selectedImage: UIImage(named: "tab-inbox")
        )
            
        let capture = CaptureViewController()
        capture.tabBarItem = UITabBarItem(
            title: "CAPTURE",
            //image: UIImage(named: "tab-inbox")?.withTintColor(AppColors.t3, renderingMode: .alwaysOriginal),
            //selectedImage: UIImage(named: "tab-inbox")?.withTintColor(AppColors.t1, renderingMode: .alwaysOriginal)
            image: UIImage(named: "tab-capture"),
            selectedImage: UIImage(named: "tab-capture")
        )
            
        tabBar.tintColor = AppColors.t1
        tabBar.unselectedItemTintColor = AppColors.t3
            
        viewControllers = [
            inbox,
            capture
        ]
    }
    

    I’ve also tried setting the Appearance proxy in 2 different ways, with many variations of settings in each:

    private func configureAppearance() {
        // NavBar
        let navAppearance = UINavigationBarAppearance()
        navAppearance.configureWithDefaultBackground()
        navAppearance.backgroundColor = AppColors.bg
        navAppearance.shadowColor = AppColors.border
        navigationController?.navigationBar.standardAppearance = navAppearance
        navigationController?.navigationBar.scrollEdgeAppearance = navAppearance
        navigationController?.navigationBar.tintColor = AppColors.t1
            
        // TabBar
        let normalColor = AppColors.t3
        let selectedColor = AppColors.t1
            
        let normalFont = UIFont(name: UIFont.JetBrainsMono.regular, size: 10) as Any
        let selectedFont = UIFont(name: UIFont.JetBrainsMono.regular_semiBold, size: 10) as Any
            
        let normalTitleAttributes: [NSAttributedString.Key: Any] = [
            .font: normalFont,
            .foregroundColor: normalColor
        ]
        let selectedTitleAttributes: [NSAttributedString.Key: Any] = [
            .font: selectedFont,
            .foregroundColor: selectedColor
        ]
            
        let appearance = UITabBarAppearance()
        //appearance.configureWithOpaqueBackground()
            
        func configure(_ itemAppearance: UITabBarItemAppearance) {
            itemAppearance.normal.iconColor = normalColor
            itemAppearance.normal.titleTextAttributes = normalTitleAttributes
                
            itemAppearance.selected.iconColor = selectedColor
            itemAppearance.selected.titleTextAttributes = selectedTitleAttributes
            }
            
        configure(appearance.stackedLayoutAppearance)
        configure(appearance.inlineLayoutAppearance)
        configure(appearance.compactInlineLayoutAppearance)
            
        tabBar.standardAppearance = appearance
        tabBar.scrollEdgeAppearance = appearance
            
        tabBar.tintColor = selectedColor
        tabBar.unselectedItemTintColor = normalColor
    }
    

    and with a constraint:

    func setupAppearence() {
        let appearance = UITabBarItem.appearance(whenContainedInInstancesOf: [MainTabBarController.self])
        appearance.setTitleTextAttributes([
            NSAttributedString.Key.foregroundColor: AppColors.t3,
            //NSAttributedString.Key.font: UIFont.custom(ofType: .medium, andSize: 10)
        ], for: .normal)
        appearance.setTitleTextAttributes([
            NSAttributedString.Key.foregroundColor: AppColors.t1,
            //NSAttributedString.Key.font: UIFont.custom(ofType: .medium, andSize: 10)
        ], for: .selected)
            
        self.tabBar.shadowImage = nil
        self.tabBar.tintColor = AppColors.t1
        self.tabBar.unselectedItemTintColor = AppColors.t3
    }
    

    I can get the font family, size and weight to change, but not the color. I thought maybe my AppColors.t1 might have been incorrectly set somewhere, so I tweaked that value and only the selected state changed. So its not using my whiteish .t1 color as the normal state, its picking up a system color from somewhere, but I cant figure out where.

    Have I missed a property somewhere? is there a liquid glass mode I have to toggle on to allow different colors or something? What have I missed? AI has been no help



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email

    Related Posts

    ios – iCloud Dashboard returns “Internal Error” when querying records across all containers

    July 27, 2026

    ios – How to resolve the “Failed to build cache” build error in Xcode on macOS running in Docker in the docurr/macos project?

    July 22, 2026

    ios – Do Critical Alert (Apple) sounds play one at a time, or can two overlap?

    July 17, 2026

    ios – Bizarre animation issue in SwiftUI

    July 12, 2026

    security – How and where mnemonic/private keys are generated/stored in IOS for mobile non-custodial wallet

    July 7, 2026

    JSON All the Way Down

    July 3, 2026
    Top Posts

    Understanding U-Net Architecture in Deep Learning

    November 25, 202566 Views

    The Next Paradigm in Efficient Inference Scaling – The Berkeley Artificial Intelligence Research Blog

    May 16, 202635 Views

    Hard-braking events as indicators of road segment crash risk

    January 14, 202634 Views
    Don't Miss

    APple’s future success with smart glasses depends on privacy – Computerworld

    July 27, 2026

    We’ve seen this story After all, since then we’ve seen the likes of Cambridge Analytica…

    2022 IEEE President K.J. Ray Liu Honored for Leadership

    July 27, 2026

    How lasers could help provide fuel for nuclear reactors

    July 27, 2026

    How to Store Petabytes of Data Without Renting It From the Cloud |

    July 27, 2026
    Stay In Touch
    • Facebook
    • Instagram
    About Us

    At GeekFence, we are a team of tech-enthusiasts, industry watchers and content creators who believe that technology isn’t just about gadgets—it’s about how innovation transforms our lives, work and society. We’ve come together to build a place where readers, thinkers and industry insiders can converge to explore what’s next in tech.

    Our Picks

    APple’s future success with smart glasses depends on privacy – Computerworld

    July 27, 2026

    2022 IEEE President K.J. Ray Liu Honored for Leadership

    July 27, 2026

    Subscribe to Updates

    Please enable JavaScript in your browser to complete this form.
    Loading
    • About Us
    • Contact Us
    • Disclaimer
    • Privacy Policy
    • Terms and Conditions
    © 2026 Geekfence.All Rigt Reserved.

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