【发布时间】:2016-12-21 00:12:11
【问题描述】:
所以我已经阅读了大量关于如何在 iOS 中的 UIButton 的 .imageView 属性上实现完美图像质量的阅读。这是我的例子->
根据以下行,我有一个 UIButton 24x24 点:
myButton = [UIButton buttonWithType:UIButtonTypeCustom];
myButton.frame = CGRectMake(82, 8, 24, 24);
myButton.contentMode = UIViewContentModeCenter;
buttonImage = [UIImage imageNamed:@"myImage.png"];
ogImage = [buttonImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
然后我将原始图像大小设置为 46x46 像素(按钮上的两倍 23x23、24x24 以防止 iOS 自动锯齿),然后将图像@2x 设置为 92x92 像素。我在 iPhone 6s(显然是视网膜显示器)上进行测试,但我的 UIButton 图像上仍然出现一些锯齿状。我在这里做错了什么?我还是不明白如何获得完美的视网膜质量吗?
这是一张图片,我希望它可以很好地显示,例如:
【问题讨论】:
-
你试过设置按钮
imageView的内容模式吗?即myButton.imageView.contentMode = UIViewContentModeCenter;