在view上面 剪切掉一部分

奶奶的熊  找了一下午才找到这个方法

- (void)drawRect:(CGRect)rect {

    // Drawing code

    [super drawRect:rect];

  

    UIBezierPath *path = [UIBezierPath bezierPathWithRect:rect];

    [path appendPath:[UIBezierPath bezierPathWithArcCenter:CGPointMake(20, 20) radius:20 startAngle:0 endAngle:2*M_PI clockwise:NO]];

    

    CAShapeLayer *shapeLayer = [CAShapeLayer layer];

    shapeLayer.path = path.CGPath;

    [self.layer setMask:shapeLayer];

}

posted @ 2015-04-23 17:34  火红的云彩  阅读(31)  评论(0)    收藏  举报