NSBezierPath drawing

前端 未结 2 1413
小蘑菇
小蘑菇 2020-12-07 23:32

I want to do a rounded rectangle outline on an NSImage and I figured that using NSBezierPath would be the best way. However, I ran into a problem: instead of drawing a nice

2条回答
  •  时光说笑
    2020-12-08 00:29

    In iOS field, just minus the radius of the circle to prevent from being clipped.

    UIBezierPath *roundPath = [UIBezierPath bezierPath];
    [roundPath addArcWithCenter:
    CGPointMake(self.frame.size.width / 2, self.frame.size.height / 2)
     radius:(self.frame.size.width / 2 - 0.5) 
    startAngle:M_PI_2 endAngle:M_PI * 3 / 2.f clockwise:YES];
    

提交回复
热议问题