iOS画一个椭圆

//椭圆

-(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;

}

你可能感兴趣的:(iOS画一个椭圆)