其实为了有立体感,只是需要在他的投影下功夫
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 5, ScreenW, 100)];
self.bgView.backgroundColor = [UIColor greenColor];
self.bgView.layer.shadowOffset = CGSizeMake(2,5);
self.bgView.layer.shadowOpacity = 0.8;
设置阴影的颜色
self.bgView.layer.shadowColor = [UIColor blueColor].CGColor;
self.bgView.layer.shadowRadius = 10;
添加一张图片
UIImageView *imageview = [[UIImageView alloc] initWithFrame:CGRectMake(20, 10, 80, 80)];
imageview.layer.shadowColor = [UIColor redColor].CGColor;
imageview.layer.shadowOffset = CGSizeMake(5,5);
imageview.layer.shadowOpacity = 1.0;
imageview.layer.shadowRadius = 10;
imageview.backgroundColor = [UIColor lightGrayColor];
self.imageview = imageview;
imageview.layer.borderColor = [UIColor yellowColor].CGColor;
imageview.layer.borderWidth = 3;
网友评论