阅读背景:

为什么CAShapeLayer的笔划延伸到框架之外?

来源:互联网 

Here's sample code:

这是示例代码:

//Called by VC:

HICircleView *circleView = [[HICircleView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];

// init of circle view

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        CAShapeLayer *borderLayer = [CAShapeLayer layer];
        borderLayer.fillColor = [UIColor whiteColor].CGColor;
        borderLayer.path = [UIBezierPath bezierPathWithOvalInRect:self.frame].CGPath;
        borderLayer.strokeColor = [[UIColor redColor] CGColor];
        borderLayer.lineWidth = 5;
        [self.layer addSublayer:borderLayer];
    }
    return self;
}
//Called by VC:



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: