您的位置:首页 > 其它

view 添加边框和阴影效果

2015-07-26 00:06 309 查看
imageView 就是需要添加 边框和 阴影的试图
//添加边框
CALayer * layer = [imageView layer];
layer.borderColor = [[UIColor redColor] CGColor];
layer.borderWidth = 5.0f;
//添加四个边阴影
imageView.layer.shadowColor = [UIColor greenColor].CGColor;//阴影颜色
imageView.layer.shadowOffset = CGSizeMake(0, 0);//偏移距离
imageView.layer.shadowOpacity = 0.5;//不透明度
imageView.layer.shadowRadius = 10.0;//半径
//    //添加两个边阴影
//    imageView.layer.shadowColor = [UIColor blueColor].CGColor;//阴影颜色
//    imageView.layer.shadowOffset = CGSizeMake(4, 4);//偏移距离
//    imageView.layer.shadowOpacity = 0.5;//不透明度
//    imageView.layer.shadowRadius = 2.0;//半径
[self.view addSubview:imageView];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: