自定义切圆角 IOS

1 篇文章 0 订阅

NSMutableAttributedString *attString = [[NSMutableAttributedStringalloc] initWithString:@"进击的巨人"];

   NSShadow *shadow = [[NSShadowalloc]init];

    shadow.shadowColor = [UIColordarkGrayColor];

    shadow.shadowBlurRadius =1;

    [attString setAttributes:[NSDictionarydictionaryWithObjectsAndKeys:shadow,NSShadowAttributeName,nil] range:NSMakeRange(0, attString.length)];

   UILabel *l = [[UILabelalloc]init];

    l.frame =CGRectMake(240,160, 100, 30);

    l.backgroundColor = [UIColorclearColor];

    l.attributedText = attString;

    [selfaddSubview:l];





-(void)createUI{

    

    

    UIBezierPath *maskPath = [UIBezierPathbezierPathWithRoundedRect:_codeBtn.boundsbyRoundingCorners:UIRectCornerTopLeft |UIRectCornerBottomLeft cornerRadii:CGSizeMake(5,5)];

   CAShapeLayer *maskLayer = [[CAShapeLayeralloc] init];

    maskLayer.frame =_codeBtn.bounds;

    maskLayer.path = maskPath.CGPath;

   _codeBtn.layer.mask = maskLayer;

    

    

    UIBezierPath *maskPath1 = [UIBezierPathbezierPathWithRoundedRect:_coutryBtn.boundsbyRoundingCorners:UIRectCornerTopRight |UIRectCornerBottomRight cornerRadii:CGSizeMake(5,5)];

   CAShapeLayer *maskLayer1 = [[CAShapeLayeralloc] init];

    maskLayer1.frame =_coutryBtn.bounds;

    maskLayer1.path = maskPath1.CGPath;

   _coutryBtn.layer.mask = maskLayer1;

    

    

    UIBezierPath *maskPath2 = [UIBezierPathbezierPathWithRoundedRect:_phoneNo.boundsbyRoundingCorners:UIRectCornerTopLeft |UIRectCornerBottomLeft cornerRadii:CGSizeMake(5,5)];

   CAShapeLayer *maskLayer2 = [[CAShapeLayeralloc] init];

    maskLayer2.frame =_phoneNo.bounds;

    maskLayer2.path = maskPath2.CGPath;

   _phoneNo.layer.mask = maskLayer2;

    

    

    UIBezierPath *maskPath3 = [UIBezierPathbezierPathWithRoundedRect:_sendBtn.boundsbyRoundingCorners:UIRectCornerTopRight |UIRectCornerBottomRight cornerRadii:CGSizeMake(5,5)];

   CAShapeLayer *maskLayer3 = [[CAShapeLayeralloc] init];

    maskLayer3.frame =_sendBtn.bounds;

    maskLayer3.path = maskPath3.CGPath;

   _sendBtn.layer.mask = maskLayer3;

    

    

//    _testLabel.layer.masksToBounds = YES;

//    _testLabel.layer.cornerRadius = 5;

//    

//    _sumbitLabel.layer.masksToBounds = YES;

//    _sumbitLabel.layer.cornerRadius = 5;

[cell.imageHeader setContentScaleFactor:[[UIScreen mainScreen] scale]];

        cell.imageHeader.autoresizingMask = UIViewAutoresizingFlexibleHeight;

        cell.imageHeader.contentMode = UIViewContentModeScaleAspectFill;

        cell.imageHeader.clipsToBounds = YES;



}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值