我试图创建一个模糊的UITableViewCell:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"Item %i Row %i Section %i", indexPath.item, indexPath.row, indexPath.section);
// if (indexPath.row != 0) {
UIGraphicsBeginImageContextWithOptions(cell.bounds.size, cell.opaque, 0.0f);
[cell drawViewHierarchyInRect:cell.frame afterScreenUpdates:YES];
UIImage *snapshotImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImage *blurredCell = [snapshotImage applyBlurWithRadius:4 tintColor:[UIColor clearColor] saturationDeltaFactor:1.0 maskImage:nil];
UIImageView *snapshotImageView = [[UIImageView alloc] initWithImage:blurredCell];
[cell addSubview:snapshotImageView];
//}
}
我可以用UIToolbar覆盖它,但这种方法似乎会大幅减慢滚动速度。 UIToolbar过多地模糊了细胞。
那么,在细胞生命周期中,如果全部,我可以把我的模糊代码?