我有一個動態的Prototype TableView。因爲我想在單元格中顯示一條線,所以我拖動一個uview並放置在單元格中。問題是,當我在移動設備上編譯應用程序時,該行並未顯示在單元格中。我在我的代碼這樣做是爲了填充單元格值在tableView中顯示自定義表分隔符UIView
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell",
forIndexPath: indexPath) as! RequestTableViewCell
cell.userNameLabel.text = firstName.uppercaseString + " "
+ lastName.uppercaseString
cell.contentView.addSubview(cell.tableSeparatorUIView)
}
我想我在這裏做得不對
cell.contentView.addSubview(cell.tableSeparatorUIView)
嘗試將UIView設置爲單元格contentView而不是cell.UIView ---'cell.contentView.addSubview(tableSeparatorUIView)' – Rahul