陈斌彬的技术博客

Stay foolish,stay hungry

设置具体的(左上方、右上方等方向)位置view的圆角

//设置view左上角、左下角的为圆角

exclusiveButton = [UIButton buttonWithType:UIButtonTypeCustom];
exclusiveButton.frame = CGRectMake(0, 0, navView.frame.size.width/2, navView.frame.size.height);
exclusiveButton.backgroundColor = RGBCOLORA(0, 0, 0, 0.3);
[exclusiveButton setTitle:@"专属客户" forState:0];
exclusiveButton.tag = 1;
//设置圆角

UIBezierPath *maskPath1 = [UIBezierPath bezierPathWithRoundedRect:exclusiveButton.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerTopLeft cornerRadii:CGSizeMake(5, 5)];
CAShapeLayer *maskLayer1 = [[CAShapeLayer alloc] init];
maskLayer1.frame = exclusiveButton.bounds;
maskLayer1.path = maskPath1.CGPath;
exclusiveButton.layer.mask = maskLayer1;

Resourece Reference