Skip to content

Instantly share code, notes, and snippets.

@ctrevarthen
Last active November 25, 2015 05:37
Show Gist options
  • Save ctrevarthen/f5cf48ef01b899072c9f to your computer and use it in GitHub Desktop.
Save ctrevarthen/f5cf48ef01b899072c9f to your computer and use it in GitHub Desktop.
ShopQuick - Tab Bar Style
let backgroundColor = UIColor.init(red: 61/255, green: 30/255, blue: 94/255, alpha: 1)
let selectedTabColor = UIColor.init(red: 247/255, green: 149/255, blue: 23/155, alpha: 1)
// background color of tabs
UITabBar.appearance().barTintColor = backgroundColor
// prevent the color from being altered by content showing through below
UITabBar.appearance().translucent = false
// prevent default styling of tab bar icons
UITabBar.appearance().shadowImage = UIImage() // cannot be nil, so create a blank image placeholder
UITabBar.appearance().backgroundImage = UIImage() // cannot be nil, so create a blank image placeholder
// font color of inactive tab
UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.whiteColor()], forState: UIControlState.Normal)
// font color of active tab
UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: selectedTabColor], forState: UIControlState.Selected)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment