【发布时间】:2016-01-04 23:48:48
【问题描述】:
我想删除UITableView 中的单元格分隔符。这是我的模拟器目前的样子:
我在视图控制器的.swift文件的viewDidLoad:方法中实现了下面这行代码:
self.tableView.separatorStyle = UITableViewCellSeparatorStyle.None
这似乎不起作用。
如何去除单元格分隔符?
这是我的cellForRowAtIndexPath: 代码:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cellIdentifier = "Cell"
let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as! RestaurantsTableViewCell
// Configure the cell...
cell.nameLabel.text = restaurants[indexPath.row].name
cell.typeLabel.text = restaurants[indexPath.row].type
cell.mainImageView.image = UIImage(named: restaurants[indexPath.row].image)
return cell
}
【问题讨论】:
-
那一行应该足够了,我认为你的行之间可能有一些填充。为您的 tableView 发布一些代码。
-
@RashwanL 你想看什么代码?
-
从函数
cellForRowAtIndexPath开始。 -
@RashwanL 我已经添加了这段代码。
-
你确定你的图片没有边框吗?
标签: ios swift uitableview