简体   繁体   English

标签栏图标像素化和切断

[英]Tab bar icons pixelated and cut off

I am trying to set my UITabbar icons via interface builder. 我试图通过界面构建​​器设置我的UITabbar图标。 Here is what I am seeing: 这是我所看到的:

在此输入图像描述

Two problems here: 这里有两个问题:

  1. Why is the bottom cut off? 为什么底部会被切断? The dimensions of these 3 images in order is 64x42, 44x44, 46x46. 这三个图像的尺寸依次为64x42,44x44,46x46。
  2. Why are they pixelated/blurry? 为什么它们像素化/模糊?

I am following the guidelines for tab bar icons listed here: 我遵循此处列出的标签栏图标的指导原则:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/mobilehig/IconsImages/IconsImages.html https://developer.apple.com/library/ios/documentation/userexperience/conceptual/mobilehig/IconsImages/IconsImages.html

I am not using the image, image@2x naming scheme. 我没有使用图像,图像@ 2x命名方案。 I am just setting these in IB. 我只是在IB中设置这些。 This app will be only released to devices with retina displays in any case. 此应用程序将仅发布到具有视网膜显示器的设备。 The screenshot is from an iPhone 5. 截图来自iPhone 5。

The only indication UIKit uses to determine if an image is retina is if it has the @2x scheme. UIKit用于确定图像是否为视网膜的唯一指示是它是否具有@ 2x方案。 Otherwise, UIKit will treat it as a non-retina image. 否则,UIKit会将其视为非视网膜图像。 This is why it is showing the image double the size it should be, because you have not used the naming scheme to tell UIKit that the image should be rendered 4 pixels per screen point. 这就是为什么它显示的图像应该是它​​的大小的两倍,因为你没有使用命名方案告诉UIKit图像应该每个屏幕点渲染4个像素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM