4

I have set in Storyboard tab bar item to be Custom, Image to my outline image and Selected image to my filled image but the selected image does not show up when I run the app.

It works if I create a tab bar item programmatically using UITabBarItem(title: String?, image: UIImage?, selectedImage: UIImage?)

I use Xcode 6.1.1.

What can be wrong?

Bartosz Bialecki
  • 4,391
  • 10
  • 42
  • 64

3 Answers3

12

I think, it is a bug of Xcode, if you add a user defined runtime attribute with type Image and keyPath "selectedImage", you'll can set your image.
Here example of the Tabbed Application template with a custom selected image on the second tab (I use a image from the first tab): enter image description here

Andrew Romanov
  • 4,774
  • 3
  • 25
  • 40
0

This is more than likely because it doesn't meet the interface requirements. Tab bar items are picky, the strokes or outlines for a selected image have to be noticeably greater than its counterparts. See here specifically the notes about the stroke width. Conditionally, if it's not a 'filled' in variation of your unselected image it has a chance of not populating depending on you create the selected image in comparison.

soulshined
  • 9,612
  • 5
  • 44
  • 79
  • Nope. this is an actual bug. Image works, selected image does not work. @ Andrew's answer works. – SimplGy Jun 07 '15 at 17:39
0

As of Xcode 9, the functionality to set a selected image is available (and works) in interface builder.

enter image description here

InsertWittyName
  • 3,930
  • 1
  • 22
  • 27