UITabBar images visible on simulator, disappear on the device

孤街浪徒 提交于 2019-12-04 17:14:45

The image should be white on transparent. It's in the UI design guide. In my case, it was grey on transparent. Simulator forgives that, the device does not.

The device itself is pickier about image formats than the simulator is. I've had a number of instances where things showed up in the simulator and didn't on the phone. What has always worked for me is to encode all of my PNGs as 24-bit PNG-24 (in Photoshop) -- for icons and the like, the increased file size is trivial, and it solves my issues with images not showing up.

After about 3 hours I noticed the not so obvious... the name of the file is processed with case sensitive rules on the device, but not within the XCode simulator (As of XCode 4.6).

For example:

If the actual file name (resource) is "first.png" then the following needs to be the case in your code ---

//DO THIS self.tabBarItem.image = [UIImage imageNamed:@"first.png"];

//NOT THIS self.tabBarItem.image = [UIImage imageNamed:@"First.png"];

Look into this first before changing your code.

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