Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tab Bar Item - Selected/Unselected icon

In Xcode 6, you now have the ability to set the icon for a tab item for its selected and unselected states. Please see the descriptions in the images below:

Selected Image - The image displayed when the tab bar item is selected.

and

Image - The image used to represent the item.

The only problem is that the image for the SELECTED states does not show. It just shows blank. Anyone else have this issue? Please see the screenshots below of the results:

REPORT tab is UNSELECTED

and

REPORT tab is SELECTED

Thanks!!!

like image 455
Mario A Guzman Avatar asked Nov 18 '14 17:11

Mario A Guzman


1 Answers

So the way to go around this:

  1. Set the tab with the default, unselected icon image you want to use in the "BAR ITEM" section in the Attributes Inspector:

enter image description here

  1. Click on the Identity Inspector, and under "USER DEFINED RUNTIME ATTRIBUTES," click the + to add a new value.

KEYPATH: selectedImage (IT HAS TO BE THIS!!!)

TYPE: Image

VALUE: The name of your selected/highlighted icon image. I use Images.xcassets for my image assets.

enter image description here

Run your app. You'll notice that the image changes to the selected (not just highlighted version of it.

Works like a charm.

like image 197
Mario A Guzman Avatar answered Nov 20 '22 14:11

Mario A Guzman