美文网首页
ios view设置圆角

ios view设置圆角

作者: 清风_____ | 来源:发表于2020-06-30 15:24 被阅读0次
    ///全角设置
     UIView *yview = [[UIView alloc] initWithFrame:frame(10, 10, 100, 200)];
            yview.backgroundColor = [UIColor whiteColor];
            yview.layer.cornerRadius = 3;
            yview.layer.masksToBounds = YES;
            [self addSubview: yview];
            
    ///半角设置
            UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect: yview.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(10, 10)];
            CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
            maskLayer.frame = yview.bounds;
            maskLayer.path = maskPath.CGPath;
            yview.layer.mask = maskLayer;
    
    ///设置弧度角
    * UIRectCornerTopLeft
    * UIRectCornerTopRight
    * UIRectCornerBottomLeft
    * UIRectCornerBottomRight
    * UIRectCornerAllCorners
    

    相关文章

      网友评论

          本文标题:ios view设置圆角

          本文链接:https://www.haomeiwen.com/subject/axsxqktx.html