2016-03-28 19 views
0

shapeShadow kodunu yorumladıysam, 2. daireyi gösterecektir. -(void)shapeShadow:(UIBezierPath *)shape'de neler oldu?Bu 2. daire neden gösterilmiyor?

- (void) shapeShadow: (UIBezierPath *) shape Bu kod, daire içine satır ekler. bu yöntem [shape addClip] çağırır ve artık çekeceği şekilde bir kırpma tarifname içine yolu değiştirdiği için

#import "SetCard.h" 

@implementation SetCard 
-(void)drawRect:(CGRect)rect 
{ 
    UIBezierPath *roundedRect=[UIBezierPath bezierPathWithRoundedRect:self.bounds cornerRadius:10]; 
    [roundedRect addClip]; 
    [[UIColor whiteColor]setFill]; 
    UIRectFill(self.bounds); 
    [[UIColor blackColor]setStroke]; 
    [self drawShape]; 
} 
-(void)drawShape 
{ 
    CGContextRef context=UIGraphicsGetCurrentContext(); 
    CGContextSaveGState(context); 
    for (int i=1; i<3; i++) { 
     CGContextTranslateCTM(context, self.bounds.size.width*(i-1)/3, 0); 
     [self drawCircle]; 
    } 
    CGContextRestoreGState(context); 
} 
-(UIBezierPath *)drawCircle 
{ 
    CGPoint center=CGPointMake(self.bounds.size.height/5, self.bounds.size.height/2); 
    UIBezierPath *circle=[UIBezierPath bezierPathWithArcCenter:center radius:self.bounds.size.height/5 startAngle:0 endAngle:12 clockwise:YES]; 
    [circle closePath]; 
    circle.lineWidth=3; 
    [[UIColor blueColor]setFill]; 
    [[UIColor blackColor]setStroke]; 
    [circle stroke];  [self shapeShadow:circle]; 

    return circle; 
} 
-(void)shapeShadow:(UIBezierPath *)shape 
{ 
// [shape addClip]; 
// for(int j=0;j<15;j++){ 
//  CGFloat c=0.05*j*self.bounds.size.height; 
//  UIBezierPath *line=[UIBezierPath bezierPath]; 
//  [line moveToPoint:CGPointMake(c, 0.0)]; 
//  [line addLineToPoint:CGPointMake(c, self.bounds.size.height)]; 
//  line.lineWidth=2; 
//  [line fill];[line stroke]; 
// } 
} 

@end 

cevap

0

, bu belirli bir bölgede çekme önler.