No edit summary |
m (Moving that xanga image to here :)) |
||
Line 2: | Line 2: | ||
[[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]] | |||
== Example == | == Example == | ||
Line 7: | Line 9: | ||
-(void)drawRect:(CGRect)rect { | -(void)drawRect:(CGRect)rect { | ||
UIBezierPath* roundedRect = [UIBezierPath roundedRectBezierPath:CGRectInset(rect, 5, 5) | UIBezierPath* roundedRect = [UIBezierPath roundedRectBezierPath:CGRectInset(rect, 5, 5) | ||
withRoundedCorners:UIBezierPathRoundedTopLeftCorner|UIBezierPathRoundedTopRightCorner|UIBezierPathRoundedBottomLeftCorner|UIBezierPathRoundedBottomRightCorner | withRoundedCorners:UIBezierPathRoundedTopLeftCorner| | ||
UIBezierPathRoundedTopRightCorner| | |||
UIBezierPathRoundedBottomLeftCorner| | |||
UIBezierPathRoundedBottomRightCorner | |||
withCornerRadius:5]; | withCornerRadius:5]; | ||
[[UIColor blackColor] setFill]; | [[UIColor blackColor] setFill]; | ||
Line 16: | Line 21: | ||
== Reference == | == Reference == | ||
* Header: http://github.com/kennytm/iphone-private-frameworks/blob/master/UIKit/UIBezierPath.h | * Header: http://github.com/kennytm/iphone-private-frameworks/blob/master/UIKit/UIBezierPath.h | ||
Revision as of 10:06, 11 October 2009
UIBezierPath is a convenient object for creating rounded-rectangular shapes.
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];
}