2016-03-07 80 views
1

我有一个动态的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) 
+0

尝试将UIView设置为单元格contentView而不是cell.UIView ---'cell.contentView.addSubview(tableSeparatorUIView)' – Rahul

回答

0

这样做: -

选择您的TableView做分离器没有在属性检查器。然后在底部添加UIView,高度为1px,前导,尾部,底部添加到tableView。 。