本文将带你了解IOS开发入门之UIView指定圆角设置,希望本文对大家学ios有所帮助。
iOS-UIView指定圆角设置
圆角设置可以指定左上、左下、右上、右下角;单个指定或多个指定。
///设置圆角[左上、右上角]
- (void)setCircular{
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(20,20)];
//创建 layer
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = self.bounds;
//赋值
maskLayer.path = maskPath.CGPath;
self.layer.mask = maskLayer;
}
本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注职坐标移动开发之IOS频道!