给视图添加阴影

来源:互联网 发布:mac重启后系统被还原 编辑:程序博客网 时间:2024/04/30 11:18

给视图添加阴影

UIImageView *imageview = [[UIImageView alloc] initWithFrame:CGRectMake(1, 1, 66.0f, 76.0f)];
  
   imageview.tag=1;
   [imageview setImage:img];
   imageview.layer.shadowColor=[UIColor blackColor].CGColor;
   imageview.userInteractionEnabled=YES;
   imageview.layer.shadowOpacity=0.5;
   imageview.layer.shadowOffset = CGSizeMake(5,3);
  
   imageview.layer.shadowColor = [UIColor blueColor].CGColor;