18. 给 UIView 添加阴影
// 阴影的颜色
self.imageView.layer.shadowColor = [UIColor blackColor].CGColor;
self.imageView.layer.shadowOpacity = 0.8;
// 阴影的圆角
self.imageView.layer.shadowRadius = 1;
// 阴影偏离的位置 (100, 50) x 方向偏离 100,y 偏离 50 正向,如果是负数正好为相反的方向
self.imageView.layer.shadowOffset = CGSizeMake(3, 4);UIEdgeInsets edges = UIEdgeInsetsMake(15, 10, 15, 10);
UIBezierPath *path = [UIBezierPath bezierPathWithRect:CGRectMake(-edges.left, -edges.top, CGRectGetWidth(self.imageView.frame) + edges.left + edges.right, CGRectGetHeight(self.imageView.frame) + edges.top + edges.bottom)];
self.imageView.layer.shadowPath = path.CGPath;Previous17. 自定义 cell 时,[self addSubView] 和 [self.contenView addSubView] 的区别Next19. 通过 runtime 控制导航栏的 hidden 属性
Last updated
Was this helpful?