Graphics Reference
In-Depth Information
[path addArcWithCenter : CGPointMake ( 150 , 100 )
radius : 25
startAngle : 0
endAngle : 2 * M_PI
clockwise : YES ];
[path moveToPoint : CGPointMake ( 150 , 125 )];
[path addLineToPoint : CGPointMake ( 150 , 175 )];
[path addLineToPoint : CGPointMake ( 125 , 225 )];
[path moveToPoint : CGPointMake ( 150 , 175 )];
[path addLineToPoint : CGPointMake ( 175 , 225 )];
[path moveToPoint : CGPointMake ( 100 , 150 )];
[path addLineToPoint : CGPointMake ( 200 , 150 )];
//create shape layer
CAShapeLayer *shapeLayer = [ CAShapeLayer layer ];
shapeLayer. strokeColor = [ UIColor redColor ]. CGColor ;
shapeLayer. fillColor = [ UIColor clearColor ]. CGColor ;
shapeLayer. lineWidth = 5 ;
shapeLayer. lineJoin = kCALineJoinRound ;
shapeLayer. lineCap = kCALineCapRound ;
shapeLayer. path = path. CGPath ;
//add it to our view
[ self .containerView. layer addSublayer :shapeLayer];
}
@end
Figure 6.1 A simple stick figure displayed using CAShapeLayer
Search WWH ::




Custom Search