iOS-UIView指定圆角设置
程序员文章站
2022-06-09 22:21:39
圆角设置可以指定左上、左下、右上、右下角;单个指定或多个指定。 ......
圆角设置可以指定左上、左下、右上、右下角;单个指定或多个指定。
///设置圆角[左上、右上角] - (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; }
上一篇: 柚子的营养价值你知多少,今天都告诉你
下一篇: Python的闭包和装饰器你真的了解吗