ios - Swift UITableView 分隔符不可见

标签 ios swift uitableview separator

我是 ios/swft 的新手,遇到了在表格 View 中显示分隔符的问题。 我已经花了几天时间尝试了几乎所有的建议,但没有一个对我有用。 我正在动态插入单元格,在这种情况下分隔符消失了。 在我正在使用的代码下方。

class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {

    @IBOutlet weak var tableView: UITableView!

    let tableData = ["One","Two","Three"]


    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        tableView.delegate = self
        tableView.dataSource = self
    }


    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return tableData.count
    }

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier("Cell")!

        cell.textLabel?.text = tableData[indexPath.row]
        return cell
    }

}

在 Storyboard上,它是 View 上的简单 TableView ,没什么特别的。

这真的很烦我,请帮助修复它。

最佳答案

原来问题只出现在模拟器上,而不是实际设备上。

关于ios - Swift UITableView 分隔符不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35150933/

相关文章:

ios - 在 valueForKey 末尾添加文本

ios - Xcode 7 Swift 2 对象大小在运行时不同

objective-c - didSelectRowAtIndexPath 一次选择多行

json - 如何过滤 UITableView 中显示的信息类型 | swift JSON

ios - 将数据传递给自定义单元格中的 UIbutton

ios - 了解 Swift 中的崩溃报告(部分应用...)

ios - Swift 3 中的 vImageBuffer_InitWithCGImage 内存泄漏

iphone - 在 CATiledLayer -setNeedsDisplay 之后,并非所有图 block 都重绘

ios - 使用swift动态设置TableViewCell的大小

json - 如何在 SwiftUI 中访问 json 响应?