Meet Ios Developer
Meet Ios Developer

Reputation: 170

Tabman Image Tint color when selected

I am using Pod Tabman for easy use of tab bar controller but I am unable to change the image color when the button is being selected.

I've tried some methodes llike rendered image view for tint color, but so far, nothing changed.

  func setUpTabBar(){
        let tabBar = TMBar.TabBar()
        tabBar.layout.transitionStyle = .snap
        tabBar.fadesContentEdges = true
        tabBar.spacing = 16.0
        tabBar.buttons.customize { (button) in
            button.selectedTintColor = .purple
            button.tintColor = .orange
            button.font = UIFont.boldSystemFont(ofSize: 14)

        }
        addBar(tabBar.systemBar(),dataSource: self,at: .bottom)
    }

using https://github.com/uias/Tabman

Upvotes: 0

Views: 477

Answers (1)

hikmat_11
hikmat_11

Reputation: 87

You have to set image rendering mode alwaysTemplate when selecting your image i.e in your barItem forBar atIdex method

let image = UIImage(named:
        "myImage")!.withRenderingMode(.alwaysTemplate)
let item = TMBarItem(image:image , badgeValue: "2")

Upvotes: 1

Related Questions