有没有办法增加间距UITableViewCell?
我创建了一个表,每个单元格只包含一个图像.图像被分配给单元格,如下所示:
cell.imageView.image = [myImages objectAtIndex:indexPath.row];
Run Code Online (Sandbox Code Playgroud)
但这会使图像放大并适合整个单元格,图像之间没有间距.
或者以这种方式说,图像的高度例如是50,并且我想在图像之间添加20个间隔.有没有办法实现这个目标?
我试图在单元格之间留出空间UItableview我已经检查了谷歌我发现的所有帖子都超过3年,当我尝试应用它们时我得到了这么多错误,是否有可能在单元格之间留出空间UItableview?
我的代码:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "ImageCell") as! ImageCell
cell.model = self.modelAtIndexPath(indexPath)
let url = URL(string: cell.model.imageName)
cell.imgBack.kf.setImage(with: url)
return cell
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
//send back playlist count
if (section == 0) {
return self.lists_arr.count
}
return 0
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated:true)
}
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, …Run Code Online (Sandbox Code Playgroud)