iOS UIView指定显示摸一个角弧形显示

关键代码:

UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect: view.bounds byRoundingCorners:UIRectCornerTopLeft cornerRadii:CGSizeMake(10, 10)];

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

maskLayer.frame = view.bounds;

maskLayer.path = maskPath.CGPath;

yearLabel.layer.mask = maskLayer;

弧形具体的方法如下:

UIRectCornerTopLeft //左上角弧形

UIRectCornerTopRight//右上角弧形

UIRectCornerBottomLeft//左下角弧形

UIRectCornerBottomRight//右下角弧形

若同时指定几个脚都有弧度用

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

各个弧度之间用 | 隔开就好了

上一篇:[转][Android] ListView中getView的原理+如何在ListView中放置多个item


下一篇:NetMQ