iOS7 Tabbar icons too big

六眼飞鱼酱① 提交于 2019-12-21 09:14:29

问题


Seems I am having difficulty with something as simple as icons.

I am building an app for iOS7 only and thus, devices are retina displays (excluding iPad 2). So I made up some 60 x 60 icons for my tabbar. However these are just too big. And 30 x 30 is a little pixelated.

Here is what a 60 x 60 icon looks like:

Can someone tell me why this is happening?


回答1:


Keep 60x60px icons but rename them as iconName@2x.png which iOS will automatically reduce to 30x30 points, roughly to half of the original size on retina devices.

If you are using assets catalogue, please make sure your icons are set to 2x icon sets.




回答2:


Or you can do something like this:

UIImage *image = [UIImage imageNamed:@"1.jpg"];

[image drawInRect:CGRectMake(0, 0, 30, 30)];

first.tabBarItem.image = image;


来源:https://stackoverflow.com/questions/22166644/ios7-tabbar-icons-too-big

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