我创建了以下辅助方法来为我的 UIImageViews 添加阴影。它看起来不错,但我注意到它显着减慢了图形渲染速度,并且在旋转设备时看起来特别糟糕。我也偶尔收到Received memory warning.
- (void)addShadowToImageView:(UIImageView *)imageView;
{
imageView.layer.shadowColor = [UIColor lightGrayColor].CGColor;
imageView.layer.shadowOffset = CGSizeMake(0, 1);
imageView.layer.shadowOpacity = 1;
imageView.layer.shadowRadius = 1.0;
imageView.clipsToBounds = NO;
}
如何优化此效果以提高性能?