我使用 QuartzCore 在 UITableViewCell 中设置 UILabel 阴影:
cell.textLabel.layer.shadowColor = [[UIColor orange] CGColor];
cell.textLabel.layer.shadowOffset = CGSizeMake(0.0, 1.0);
cell.textLabel.layer.shadowRadius = 0.0;
cell.textLabel.layer.masksToBounds = NO;
但是由于它的性能很慢,我必须实现-(void)drawRect:(CGRect)rect
方法。最近我发现 UILabel 的阴影可以用它的属性来设置:
cell.textLabel.shadowColor = [UIColor orangeColor];
cell.textLabel.shadowOffset = CGSizeMake(0.0, 1.0);
现在我想要删除drawRect:
实现并通过属性设置阴影。
QuartzCore CALayershadowRadius
默认值为 3.0。虽然 UILabel 没有这个属性,但是否意味着阴影半径等于 0.0?