0
我正在嘗試在我的willDisplay cell:UITableViewCell
方法中複製自動UITableViewCell
分隔符插入。插頁我的應用程序的分離取決於Bool
條件,就像這樣:自動UITableView分隔符插入
override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
let profileCell = cell as! ProfileCell
profileCell.separatorInset = isProfileComplete ? UIEdgeInsets.zero : UIEdgeInsets(0, 15, 0, 0)
}
我目前使用
UIEdgeInsets(0, 15, 0, 0)
複製「自動」
UITableViewCell
分離器插圖
,但這是不夠的所有設備。我希望有類似UIEdgeInsets.automatic
的東西,但這只是而不是存在。有任何想法嗎?
@MacLeod您可以使用視圖創建自己的自定義分隔符,並應用適當的約束條件。 –
爲什麼不添加自定義視圖並配置其外觀? –
@TusharSharma我明白一個自定義視圖是可能的,但是有什麼方法可以使用默認的分隔視圖來完成此操作嗎? –