ios中给UIview切两个或多个圆角

    CGFloat ymax = CGRectGetMaxY(curentCarLabel.frame) +21;
    CGRect bounds = CGRectMake(0, 0, KScreenW, headView.frame.size.height - 10 - ymax);
    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(15, 15)];
    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
    maskLayer.frame = bounds;
    maskLayer.path = maskPath.CGPath;
    [conerOfTwoView.layer addSublayer:maskLayer];
    conerOfTwoView.layer.mask = maskLayer;
    conerOfTwoView.layer.masksToBounds = YES;
    

你可能感兴趣的:(ios中给UIview切两个或多个圆角)