![](/img/trans.png)
[英]IOS Swift 5 Add Custom TableViewCell Separator for Dynamic Height TableView Cell
[英]How to add custom tableviewcell separator?
我想像這樣添加自定義tableviewcell分隔符
- - - - - - 細胞 - - - - - -
---自定義Sperator ---
- - - - - - 細胞 - - - - - -
---自定義Sperator ---
我嘗試過
在情節提要中的單元格下面添加uiview並連接
@IBOutlet weak var sperator: UIView!
cellForRow中的addcode 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 :(
如果您更改一個代碼,則可以看到生成器行
cell.contentView.caddSubview(self.sperator)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.