iOS为视图添加阴影

为button按钮添加下方的阴影

  _shareBtn . layer . cornerRadius = 5.0 ;
   
_shareBtn . layer . shadowColor =[ AppUtils callColorFromHexRGB : @"d99e0b" ]. CGColor ;
   
_shareBtn . layer . shadowOffset = CGSizeMake ( 0 , 3 );
    _shareBtn.layer.shadowOpacity = 1.0;
不能加layer.maskToBounds == YES;添加之后阴影就不回出现了。
_shareBtn . layer . shadowOffset = CGSizeMake ( 0 , 3 )…………………默认是(0,-3)就是上阴影。

你可能感兴趣的:(iOS为视图添加阴影)