1

I have been scratching my hair for this question for several days.

Basically, the problem is:

I have a square button(equal width and height), with an image placed in this UIButton's UIImageView. And I want to have a circular border for this button. So I achieve it in this way:

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;

Well, the border is circular, but when it is displayed in iphone6/iphone6s, the border looks very fuzzy/blurred, and the bottom border is even a bit chopped off. However, when in iphone5s/iphone6 plus, the border looks better(though still a bit fuzzy). So I wonder what might have caused this problem?

Here is what it looks like in iphone 6 (The left one with border width 0.5f, the right one is 1.f):

enter image description here

And here is how it looks in iphone5s(at least I still have the bottom border):

enter image description here

Thank you so much in advance!

Chenglu
  • 844
  • 1
  • 9
  • 17
  • Does it look the same if the button moves up or down a pixel or two? – FishStix Jul 18 '16 at 23:48
  • @FishStix, unfortunately, it looks the same – Chenglu Jul 18 '16 at 23:57
  • different device has different resolution, in 6s, the resolution is much higher than 5s, so border width 0.5f will looks more thin than in 5s. – childrenOurFuture Jul 19 '16 at 03:28
  • @childrenOurFuture, thanks for the comment. But it works find in 6 plus, and I assume 6 plus has the highest resolution? Also, it is not only thinner in iphone 6, the bottom border is cut-off a bit if you noticed – Chenglu Jul 19 '16 at 03:35

1 Answers1

0

Hope you checked this project in simulators only.The simulators sometimes shows this effect not at all devices.You should check this in devices.

if that screen have scrolling that issue of the bottom border is may changed.you can also check that too.the simulators making this issue not your constraints mistakes i think.

OR you can increase the border width.

  • Hi Thanveer, thanks for the reply. I hoped the same. But sadly, I have tried on real devices like iphone5s and iphone6, still not working. I understand thickening the border can mitigate the issue, but that is not the solution I am seeking for :(. – Chenglu Jul 19 '16 at 17:06
  • what about the border width?.hope you chose constant value for width and height constraint ,right? – Thanveer Ahammed Jul 21 '16 at 05:31