圓角設置可以指定左上、左下、右上、右下角;單個指定或多個指定。 ...
圓角設置可以指定左上、左下、右上、右下角;單個指定或多個指定。
///設置圓角[左上、右上角] - (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; }