Categories: iOS

#iOS タブバーのアイテムのselectedImageに画像をセットしても表示されない問題の解決法

Xcode6でタブバーのItemのattributesにselectedImageとセットするところがあるのだが、

ここに画像をセットして、いざ選択してみるとまったくこれがうんともすんとも表示されない。

その時の解決法。

なんでセットする項目があるのになんで表示されないねーんとおもってぐぐったら答えが書いてあった

This is my setup for a tab bar item:However when clicking on the item inside the app the 1051-id-badge-selected image is not shown, instead nothing is shown:Is something wrong with my setup? Any
Set tab bar item selected image in xcode 6 - Stack Overflow

To get around this issue and set selected image without writing any code, we can also use “User Defined Run Attributes”.

Select the tab bar item, then in ‘Identity Inspector’, add a new value from ‘User Defined Runtime Attributes’.

Set the ‘Key Path’ to selectedImage, and choose ‘Type’ Image, then fill in the ‘Value’ with your image name.

まじかー!!

User Defined Run AttributesでいちいちselectedImageをセットして画像名を指定してあげないと表示できないみたいす。
コードだったら問題ないみたいなのですが。。。
ちょっとめんどくさいけど、まぁ表示されたからいいや。
めでたしめでたし。
mogmet

View Comments

  • Thanks for sharing. I read many of your blog posts, cool, your blog is very good.

  • Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?

  • Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.

  • Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.

  • Thanks for sharing. I read many of your blog posts, cool, your blog is very good.