以编程方式绘制圆角矩形[重复]

问题描述 投票:1回答:1

可能重复: How to draw a rounded rectangle in Core Graphics / Quartz 2D?

我想以编程方式为我覆盖的UIView绘制一个圆角矩形,

我该怎么做?

iphone ios cocoa-touch uikit core-graphics
1个回答
3
投票

NSBezierPath有一个特殊的+bezierPathWithRoundedRect:xRadius:yRadius:,请查看文档。

NSBezierPath *path =
  [NSBezierPath bezierPathWithRoundedRect:NSMakeRect(...)
                                  xRadius:3.0f
                                  yRadius:3.0f];
[path fill];
© www.soinside.com 2019 - 2024. All rights reserved.