UIBezierPath: Difference between revisions

From iPhone Development Wiki
m (Moving that xanga image to here :))
(Use the SVG version of the image.)
Line 3: Line 3:
[[UIBezierPath]] is a convenient object for creating rounded-rectangular shapes.
[[UIBezierPath]] is a convenient object for creating rounded-rectangular shapes.


[[Image:UIBezierPath_Examples.png|center|framed|How the different paths look like]]
[[Image:UIBezierPath_Examples.svg|center|framed|How the different paths look like]]


== Example ==
== Example ==

Revision as of 07:36, 12 October 2009


UIBezierPath is a convenient object for creating rounded-rectangular shapes.

Error creating thumbnail: File missing
How the different paths look like

Example

-(void)drawRect:(CGRect)rect {
  UIBezierPath* roundedRect = [UIBezierPath roundedRectBezierPath:CGRectInset(rect, 5, 5)
                                               withRoundedCorners:UIBezierPathRoundedTopLeftCorner|
                                                                  UIBezierPathRoundedTopRightCorner|
                                                                  UIBezierPathRoundedBottomLeftCorner|
                                                                  UIBezierPathRoundedBottomRightCorner
                                                 withCornerRadius:5];
  [[UIColor blackColor] setFill];
  [roundedRect fill];
}

Reference