美文网首页
iOS开发-阴影效果

iOS开发-阴影效果

作者: zxb有缘 | 来源:发表于2021-05-11 18:57 被阅读0次
    UIView * supBgView=[[UIView alloc]initWithFrame:CGRectMake(10, 0, self.width-20, 160)];
    

    //必须设置背景色 否则没有效果
    supBgView.backgroundColor=[UIColor whiteColor];
    supBgView.centerY=self.height/2.0;
    [self addSubview:supBgView];
    // 阴影颜色
    supBgView.layer.shadowColor = rgb(100, 100, 100).CGColor;
    // 阴影偏移量 默认为(0,3)
    supBgView.layer.shadowOffset = CGSizeMake(1, 1);
    // 阴影透明度
    supBgView.layer.shadowOpacity = .5;

    相关文章

      网友评论

          本文标题:iOS开发-阴影效果

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