Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/extensions/Variables/includes/ExtVariables.php on line 198
UIBezierPath: Difference between revisions - iPhone Development Wiki

UIBezierPath: Difference between revisions

From iPhone Development Wiki
(Created page with '{{occlass|library=UIKit.framework}} UIBezierPath is a convenient object for creating rounded-rectangular shapes. == Example == <source lang="objc"> -(void)drawRect:(CGRect)…')
 
mNo edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{occlass|library=UIKit.framework}}
[[UIBezierPath]] is a convenient object for creating rounded-rectangular shapes.


[[UIBezierPath]] is a convenient object for creating rounded-rectangular shapes.
Starting from 3.2, this class becomes public, but the interface is dramatically changed to match that of [http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSBezierPath_Class/Reference/Reference.html NSBezierPath].
 
[[Image:UIBezierPath_Examples.svg|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|
                                                    withCornerRadius:5.0f];
                                                                  UIBezierPathRoundedTopRightCorner|
 
                                                                  UIBezierPathRoundedBottomLeftCorner|
 
                                                                  UIBezierPathRoundedBottomRightCorner
                                                withCornerRadius:5];
  [[UIColor blackColor] setFill];
  [roundedRect fill];
}
}
</source>
</source>


* How the different paths look like: http://xa1.xanga.com/70ff567527733256065727/w203670103.png
== Reference ==
* Header: http://github.com/kennytm/iphone-private-frameworks/blob/master/UIKit/UIBezierPath.h
 
{{occlass|library=UIKit.framework|navbox=on}}

Latest revision as of 09:14, 6 February 2010

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

Starting from 3.2, this class becomes public, but the interface is dramatically changed to match that of NSBezierPath.

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