iOS开发-阴影效果

2021-05-11  本文已影响0人  zxb有缘
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;

上一篇下一篇

猜你喜欢

热点阅读