Skip to content

Instantly share code, notes, and snippets.

View aboodmufti's full-sized avatar

Abood Mufti aboodmufti

View GitHub Profile
@aboodmufti
aboodmufti / TabViewController.swift
Last active January 25, 2024 11:35
How to customize iOS tab icon colors (2 ways)
override func viewDidLoad() {
super.viewDidLoad()
//change text under icon
UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.init(netHex: 0x000000)], forState: .Normal)
UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.init(netHex: 0xffffff)], forState: .Selected)
//store every image in a variable
let homeUnselectedImage: UIImage = UIImage(named: "home_grey")!.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
let homeSelectedImage: UIImage = UIImage(named: "home_white")!.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)