Swift UITableView分隔符不可见

mih*_*tel 3 uitableview separator ios swift

我是ios/swft的新手,遇到了在表视图中显示分隔符的问题.我已经花了几天时间尝试了几乎所有的建议,但它们都不适合我.我正在动态插入单元格,在这种情况下,分隔符会消失.在我正在使用的代码下面.

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
    }

}
Run Code Online (Sandbox Code Playgroud)

在故事板上,它是一个简单的视图,没有什么特别的.

这真让我讨厌,请帮忙解决.

mih*_*tel 10

事实证明,问题仅在模拟器上,而不是在实际设备上.