iOS画一个椭圆

2018-01-24  本文已影响0人  阿木小丸子

//椭圆

-(void)rangleView:(CGRect)frame{

    UIBezierPath *rectPath = [UIBezierPath bezierPathWithRect:self.frame];

    UIBezierPath *circlePath = [UIBezierPath bezierPathWithOvalInRect:frame];

    [rectPath appendPath:circlePath];

    CAShapeLayer *mask1 = [CAShapeLayer layer];

    mask1.frame = CGRectMake(0, 0, COVERVIEW_WIDTH, COVERVIEW_HEIGHT);

    mask1.backgroundColor = [UIColor clearColor].CGColor;

    mask1.fillColor = [UIColor whiteColor].CGColor;

    mask1.path = rectPath.CGPath;

    mask1.fillRule = kCAFillRuleEvenOdd;

    self.layer.mask = mask1;

}

上一篇 下一篇

猜你喜欢

热点阅读