iOS开发者进阶

iOS 设置阴影

2025-01-09  本文已影响0人  __Mr_Xie__

⚠️注意

示例代码如下:

self.customView.layer.cornerRadius = 8.0;
 // 设置阴影一定要把masksToBounds/设置为NO
self.customView.layer.masksToBounds = NO;

//shadowColor阴影颜色
self.customView.layer.shadowColor = ColorSetWithAlpha(@"000000", 0.08).CGColor;
//shadowOffset阴影偏移
self.customView.layer.shadowOffset = CGSizeMake(0,0);
//阴影透明度
self.customView.layer.shadowOpacity = 0.8;
//阴影半径
self.customView.layer.shadowRadius = 8.0;
上一篇 下一篇

猜你喜欢

热点阅读