我想添加像这样的自定义tableviewcell分隔符
------------单元格------------
---自定义sperator---
------------单元格------------
---自定义sperator---
我试过了
在 Storyboard 中的单元格下方添加 uiview 并连接
@IBOutlet weak var sperator: UIView!
在 cellForRow cellForRowAtIndexPath 中添加代码
override func tableView(tableView: UITableView, cellForRowAtIndexPathindexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier("MainListCell",forIndexPath: indexPath) as! MainTableViewCell let list = List(index: indexPath.row) cell.titleLabel.text = list.title! cell.titleIcon.image = list.icon! cell.detailTitleLabel.text = list.detailtitle! cell.coinCountLabel.text = "X0" cell.addSubview(self.sperator) return cell }
但是,我可以看到 UIView :(
最佳答案
如果你改变一个代码,你可以看到sperator行
cell.contentView.caddSubview(self.sperator)
关于ios - 如何添加自定义tableviewcell分隔符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35354088/