【发布时间】:2016-04-05 11:34:05
【问题描述】:
我正在绘制圆角矩形。问题 - 角落不锋利。这个问题有解决办法吗?
这是我的绘图代码 (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 ();
【问题讨论】:
-
您是否尝试过在实际设备和 iOS 模拟器上运行它?你也应该看看这个答案:stackoverflow.com/a/2181479/4984832
标签: ios xamarin core-graphics rounded-corners antialiasing