UIImageView新增陰影和邊框
阿新 • • 發佈:2019-01-06
//給imageview新增陰影和邊框
UIImageView * imgvPhoto = [UIImageView alloc] init];
//新增邊框
CALayer * layer = [_imgvPhoto layer];
layer.borderColor = [[UIColor whiteColor] CGColor];
layer.borderWidth = 5.0f;
//新增四個邊陰影
_imgvPhoto.layer.shadowColor = [UIColor blackColor].CGColor;
_imgvPhoto.layer.shadowOffset = CGSizeMake( 0, 0);
_imgvPhoto.layer.shadowOpacity = 0.5;
_imgvPhoto.layer.shadowRadius = 10.0;給iamgeview新增陰影 < wbr > 和邊框
//新增兩個邊陰影
_imgvPhoto.layer.shadowColor = [UIColor blackColor].CGColor;
_imgvPhoto.layer.shadowOffset = CGSizeMake(4, 4);
_imgvPhoto.layer.shadowOpacity = 0.5;
_imgvPhoto.layer.shadowRadius = 2.0;