shadowColor 图片阴影 iOS

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor= [UIColor yellowColor];
    
    UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(100, 100, 100, 100)];
    [btn setTitle:@"asdsdfa" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [btn setBackgroundImage:[UIImage imageNamed:@"11111"] forState:UIControlStateNormal];
    //加阴影
    btn.layer.shadowColor = [UIColor redColor].CGColor;//shadowColor阴影颜色
    btn.layer.shadowOffset = CGSizeMake(4,4);//shadowOffset阴影偏移,x向右偏移4,y向下偏移4,默认(0, -3),这个跟shadowRadius配合使用
    btn.layer.shadowOpacity = 0.8;//阴影透明度,默认0
    btn.layer.shadowRadius = 4;//阴影半径,默认3
    [self.view addSubview:btn];
}