본문 바로가기

code snippet

[iOS] UIBezierPath를 이용해서 태극 문양 그리기

iOS에 UIBezierPath를 연습해보고 있다.
태극 문양을 한번 그려보고 기록을 남긴다.
일단 인증~ 오전 1시 34분의 위용!



코드는 아래에~

UIBezierPath *path = [UIBezierPath bezierPath];


[[UIColor blueColor] setFill];

[path moveToPoint:CGPointMake(20, 220)];

[path addArcWithCenter:CGPointMake(90, 220) radius:70.0 startAngle:M_PI endAngle:M_PI*2 clockwise:NO];

[path addArcWithCenter:CGPointMake(230, 220) radius:70.0 startAngle:M_PI endAngle:M_PI*2 clockwise:YES];

[path addArcWithCenter:CGPointMake(160, 220) radius:140.0 startAngle:M_PI*2 endAngle:M_PI clockwise:YES];

[path fill];


path = [UIBezierPath bezierPath];

[[UIColor redColor] setFill];

[path moveToPoint:CGPointMake(20, 220)];

[path addArcWithCenter:CGPointMake(90, 220) radius:70.0 startAngle:M_PI endAngle:M_PI*2 clockwise:NO];

[path addArcWithCenter:CGPointMake(230, 220) radius:70.0 startAngle:M_PI endAngle:M_PI*2 clockwise:YES];

[path addArcWithCenter:CGPointMake(160, 220) radius:140.0 startAngle:M_PI*2 endAngle:M_PI clockwise:NO];

[path fill];


반응형