我UITableView在我的应用程序中正确实现了.现在我想稍微更改UI,所以我希望每个单元格之间有一个空格,就像我在这张图中所示:

有可能吗?如果是这样,怎么样?
同样在每个单元格之间,我可以使其透明,以便它没有任何白色区域阻挡视图的背景图像吗?
我已经做了一个UIViewController符合UITableViewDataSource和UITableViewDelegate协议,并有一个UITableViewas的子视图.
我已将backgroundView表的属性设置为a UIImageView,以便将图像显示为表的背景.
为了在单元格之间有自定义间距,我使行高度大于我想要的,并将单元格的contentView自定义为我想要的大小,使其看起来有额外的空间(遵循此SO答案).
我想为单元格添加模糊,以便背景模糊,我通过Brad Larson的GPUImage框架完成了这项工作.然而,这工作正常,因为我希望背景模糊在滚动时更新,滚动变得非常迟缓.
我的代码是:
//Gets called from the -scrollViewDidScroll:(UIScrollView *)scrollView method
- (void)updateViewBG
{
UIImage *superviewImage = [self snapshotOfSuperview:self.tableView];
UIImage* newBG = [self applyTint:self.tintColour image:[filter imageByFilteringImage:superviewImage]];
self.layer.contents = (id)newBG.CGImage;
self.layer.contentsScale = newBG.scale;
}
//Code to create an image from the area behind the 'blurred cell'
- (UIImage *)snapshotOfSuperview:(UIView *)superview
{
CGFloat scale = 0.5;
if (([UIScreen mainScreen].scale > 1 || self.contentMode == …Run Code Online (Sandbox Code Playgroud) 我正在尝试实现这个设计,但我浏览过的所有解决方案都无法工作,而且据我所知,这可能是因为单元格和UITableView之间的间距.
这是设计:
因此,基本上我想要实现的是从所有4个侧面获得阴影以及每个单元格与下一个单元格之间的一些间距.谢谢
编辑:这是我试过的代码.
let shadowSize : CGFloat = 5.0
let shadowPath = UIBezierPath(rect: CGRect(x: -shadowSize / 2,
y: -shadowSize / 2,
width: self.avatarImageView.frame.size.width + shadowSize,
height: self.avatarImageView.frame.size.height + shadowSize))
self.avatarImageView.layer.masksToBounds = false
self.avatarImageView.layer.shadowColor = UIColor.black.cgColor
self.avatarImageView.layer.shadowOffset = CGSize(width: 0.0, height: 0.0)
self.avatarImageView.layer.shadowOpacity = 0.5
self.avatarImageView.layer.shadowPath = shadowPath.cgPath
Run Code Online (Sandbox Code Playgroud)
编辑2:我想指出我所有单元格的对象都在容器UIView中.以上所有代码都适用于此UIView.