UITabBarItem images just appear as a grey block

2019-03-01 14:53发布

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!

enter image description here

4条回答
甜甜的少女心
2楼-- · 2019-03-01 15:24

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"];

查看更多
走好不送
3楼-- · 2019-03-01 15:27

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

查看更多
▲ chillily
4楼-- · 2019-03-01 15:30

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.

查看更多
在下西门庆
5楼-- · 2019-03-01 15:32

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)

enter image description here

enter image description here

查看更多
登录 后发表回答