0

I am drawing rounded rectangle. Problem - corners are not sharp. Is there any solution for this problem?

Zoom 100%

Zoomed in

Here is my drawing code (Xamarin)

var thickness = (nfloat)Math.Min (Math.Min (_renderer.View.Thickness.Left, _renderer.View.Thickness.Right), Math.Max (_renderer.View.Thickness.Top, _renderer.View.Thickness.Bottom));
var path = UIBezierPath.FromRoundedRect (new CGRect(this.Bounds.X + thickness / 2, this.Bounds.Y + thickness / 2, this.Bounds.Width - thickness, this.Bounds.Height - thickness), (nfloat)_renderer.View.CornerRadius);

context.SetShouldAntialias (true);
context.SetStrokeColor (_renderer.View.Color.ToCGColor ());
context.SetFillColor (_renderer.View.BackgroundColor.ToCGColor ());
path.LineWidth = thickness;

path.Fill ();
path.Stroke ();
0xDEAD BEEF
  • 2,074
  • 7
  • 31
  • 46
  • Have you tried running that on an actual device vs the iOS simulator? You should also look at this answer : http://stackoverflow.com/a/2181479/4984832 – SushiHangover Apr 05 '16 at 13:06

1 Answers1

-1

Why don't you use a cornerradius instead ?

Btw you must check the scale property of your layer. It must be set the the same value as the mainview scale (i.e.: 2 on retina devices). And by default it is 1.

Softlion
  • 12,281
  • 11
  • 58
  • 88