init(roundedRect:cornerRadius:)
Creates and returns a new Bézier path object with a rounded rectangular path.
Declaration
convenience init(roundedRect rect: CGRect, cornerRadius: CGFloat)Parameters
- rect:
The rectangle that defines the basic shape of the path.
- cornerRadius:
The radius of each corner oval. A value of
0results in a rectangle without rounded corners. Values larger than half the rectangle’s width or height are clamped appropriately to half the width or height.
Return Value
A new path object with the rounded rectangular path.
Discussion
This method creates a closed subpath, proceeding in a clockwise direction (relative to the default coordinate system) as it creates the necessary line and curve segments.