【发布时间】:2016-11-21 16:39:32
【问题描述】:
我已经为这个问题抓狂了好几天了。
基本上,问题是:
我有一个方形按钮(宽度和高度相等),图像放置在此 UIButton 的 UIImageView 中。我想为这个按钮设置一个圆形边框。所以我是这样实现的:
self.myButton.imageView.layer.borderColor = [[UIColor colorWithWhite:1 alpha:0.68] CGColor];
self.myButton.imageView.layer.borderWidth = 0.5f;
self.myButton.imageView.layer.cornerRadius = self.myButton.imageView.frame.size.height / 2;
好吧,边框是圆形的,但是在iphone6/iphone6s中显示时,边框看起来很模糊/模糊,底部边框甚至有点被切掉了。然而,在 iphone5s/iphone6 plus 中,边框看起来更好(虽然还是有点模糊)。所以我想知道是什么导致了这个问题?
这是在 iphone 6 中的样子(左边是边框宽度 0.5f,右边是 1.f):
这是它在 iphone5s 中的样子(至少我还有底部边框):
非常感谢您!
【问题讨论】:
-
如果按钮向上或向下移动一两个像素,它看起来是否相同?
-
@FishStix,不幸的是,它看起来一样
-
不同设备的分辨率不同,6s的分辨率比5s高很多,所以边框宽度0.5f会比5s看起来更细。
-
@childrenOurFuture,感谢您的评论。但它适用于 6 plus,我假设 6 plus 具有最高分辨率?另外,它不仅在 iphone 6 中更薄,如果你注意到的话,底部边框被切断了一点
标签: ios uibutton ios-autolayout cglayer