【问题标题】:Draw a Rounded Rectangle programmatically [duplicate]以编程方式绘制圆角矩形[重复]
【发布时间】:2012-01-16 02:53:43
【问题描述】:

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

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

我该如何处理?

【问题讨论】:

    标签: iphone ios cocoa-touch uikit core-graphics


    【解决方案1】:

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

    NSBezierPath *path =
      [NSBezierPath bezierPathWithRoundedRect:NSMakeRect(...)
                                      xRadius:3.0f
                                      yRadius:3.0f];
    [path fill];
    

    【讨论】:

      猜你喜欢
      • 2015-03-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多