簡體   English   中英

如何添加自定義tableviewcell分隔符?

[英]How to add custom tableviewcell separator?

我想像這樣添加自定義tableviewcell分隔符

- - - - - - 細胞 - - - - - -

---自定義Sperator ---

- - - - - - 細胞 - - - - - -

---自定義Sperator ---

我嘗試過

  1. 在情節提要中的單元格下面添加uiview並連接

     @IBOutlet weak var sperator: UIView! 
  2. 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM