UITabBarItem images just appear as a grey block

强颜欢笑 提交于 2019-12-20 05:34:13

问题


I have created .png icons 20 x 20 and when I set the image property in the nib they just appear grey blocks.

Any ideas?

UPDATE: Here is one of the icons!


回答1:


The standard tabbar icons in iOS are rendered solely from the alpha channel. Colors are ignored completely. Instead of colors you can use different alpha values that lead to a different shade of gray (or blue if selected)

Make the background of your icons transparent.




回答2:


Download these attached images and pass them to your designer and ask him to just create images like these (when you open them in PS you'll know the difference)




回答3:


This happened to me in iOS 5, I got around it by setting UIImage Outlet property in the Xib to 'Custom' and then set the label programmtically so : imageOne = [UIImage imageNames@"Dog.png"];




回答4:


Try saving the file as png interlaced. In photoshop at least it gives you an option of interlaced or normal.



来源:https://stackoverflow.com/questions/8616820/uitabbaritem-images-just-appear-as-a-grey-block

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!