UIView *view = [[UIView alloc]initWithFrame:CGRectMake(50, 200, 100, 100)];
view.backgroundColor = [UIColor redColor];
view.layer.shadowOpacity = 0.8;//阴影透明度,默认0
view.layer.shadowOffset = CGSizeMake(10,10);
view.layer.shadowColor = [UIColor greenColor].CGColor;
view.layer.shadowRadius = 3;//阴影半径,默认3
[self.view addSubview:view];
时间: 2024-10-07 10:00:00