所有4条边的角半径:
UIBezierPath* rectanglePath = [UIBezierPath bezierPathWithRoundedRect: CGRectMake(x,y,width,height) cornerRadius: 11]; [UIColor.grayColor setFill]; [rectanglePath fill];
左上边缘的拐角半径:
UIBezierPath* rectanglePath = [UIBezierPath bezierPathWithRoundedRect: CGRectMake(x,y,width,height) byRoundingCorners: UIRectCornerTopLeft cornerRadii: CGSizeMake(11, 11)]; [rectanglePath closePath]; [UIColor.grayColor setFill]; [rectanglePath fill];
右上角的拐角半径:
UIBezierPath* rectanglePath = [UIBezierPath bezierPathWithRoundedRect: CGRectMake(x,y,width,height) byRoundingCorners: UIRectCornerTopRight cornerRadii: CGSizeMake(11, 11)]; [rectanglePath closePath]; [UIColor.grayColor setFill]; [rectanglePath fill];
左下边缘的拐角半径:
UIBezierPath* rectanglePath = [UIBezierPath bezierPathWithRoundedRect: CGRectMake(x,y,width,height) byRoundingCorners: UIRectCornerBottomLeft cornerRadii: CGSizeMake(11, 11)]; [rectanglePath closePath]; [UIColor.grayColor setFill]; [rectanglePath fill];
右下角的拐角半径:
UIBezierPath* rectanglePath = [UIBezierPath bezierPathWithRoundedRect: CGRectMake(x,y,width,height) byRoundingCorners: UIRectCornerBottomRight cornerRadii: CGSizeMake(11, 11)]; [rectanglePath closePath]; [UIColor.grayColor setFill]; [rectanglePath fill];
底边的拐角半径:
UIBezierPath* rectanglePath = [UIBezierPath bezierPathWithRoundedRect: CGRectMake(x,y,width,height) byRoundingCorners: UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii: CGSizeMake(11, 11)]; [rectanglePath closePath]; [UIColor.grayColor setFill]; [rectanglePath fill];
上边缘的拐角半径:
UIBezierPath* rectanglePath = [UIBezierPath bezierPathWithRoundedRect: CGRectMake(x,y,width,height) byRoundingCorners: UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii: CGSizeMake(11, 11)]; [rectanglePath closePath]; [UIColor.grayColor setFill]; [rectanglePath fill];