iOS给控件或view添加阴影图层

2017-03-24  本文已影响823人  AnderQZ
CGPoint position= CGPointMake(_blueView.center.x, _blueView.center.y);//阴影中心点
CGFloat borderWidth = 2;
//阴影图层
CALayer *layerShadow=[[CALayer alloc]init];
layerShadow.bounds = _blueView.bounds;
layerShadow.position = position;
layerShadow.shadowColor = [UIColor grayColor].CGColor;
layerShadow.shadowOffset = CGSizeMake(2, 1);
layerShadow.shadowOpacity = 1;
layerShadow.borderColor = [UIColor whiteColor].CGColor;
layerShadow.borderWidth = borderWidth;
[self.view.layer addSublayer:layerShadow];
上一篇下一篇

猜你喜欢

热点阅读