iOS OC 设置上下左右的圆角

2017-02-25  本文已影响0人  Wougle

以UILabel为例:

UIBezierPath * maskPath = [UIBezierPath bezierPathWithRoundedRect:label.bounds byRoundingCorners:UIRectCornerBottomLeft|UIRectCornerTopLeft cornerRadii:CGSizeMake(3, 3)];

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

maskLayer.frame = label.bounds;

maskLayer.path = maskPath.CGPath;

label.layer.mask = maskLayer;

上一篇 下一篇

猜你喜欢

热点阅读