设置UIButton,UITextFild边框圆角(上半边或下半边)

    UIView *view2 = [[UIView alloc] initWithFrame:CGRectMake(120, 10, 80, 80)];

    view2.backgroundColor = [UIColor redColor];

    [self.view addSubview:view2];

    

    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:view2.bounds          byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight    cornerRadii:CGSizeMake(10, 10)];

    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];

    maskLayer.frame = view2.bounds;

    maskLayer.path = maskPath.CGPath;

    view2.layer.mask = maskLayer;


你可能感兴趣的:(UIView,设置圆角)