Ios 中的uitableview单元具有横向分隔符

Ios 中的uitableview单元具有横向分隔符,ios,swift,uitableview,swift3,xcode8,Ios,Swift,Uitableview,Swift3,Xcode8,我试图在Swift 3中创建一个非常简单的索引表视图。 我设法将索引添加到视图中,但当我添加节标题时,每个单元格的右侧都显示了一条奇怪的分隔线() 我不知道它是从哪里来的,它也没有出现在我在网上看到的其他索引tableview教程中 以下是TableViewController的代码: class TableViewController: UITableViewController { var tableData : [String] = [] var indexOfNumber

我试图在Swift 3中创建一个非常简单的索引表视图。 我设法将索引添加到视图中,但当我添加节标题时,每个单元格的右侧都显示了一条奇怪的分隔线()

我不知道它是从哪里来的,它也没有出现在我在网上看到的其他索引tableview教程中

以下是TableViewController的代码:

class TableViewController: UITableViewController
{
    var tableData : [String] = []
    var indexOfNumbers : [String] = []

    override func viewDidLoad()
    {
        super.viewDidLoad()

        let numbers = "100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500"
        tableData = numbers.components(separatedBy: " ")

        let indexes = "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
        indexOfNumbers = indexes.components(separatedBy: " ")
    }

    override func numberOfSections(in tableView: UITableView) -> Int { return indexOfNumbers.count }

    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 1 }

    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
    {
        let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)

        cell.textLabel?.text = tableData[indexPath.section]

        print(indexPath.section, indexPath.row, separator : " ")

        return cell
    }

    override func tableView(_ tableView: UITableView, sectionForSectionIndexTitle title: String, at index: Int) -> Int
    {
        let temp = indexOfNumbers as NSArray
        return temp.index(of: title)
    }

    override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String?
    {
        return "Section \(section)"
    }

    override func sectionIndexTitles(for tableView: UITableView) -> [String]?
    {
        return indexOfNumbers
    }
}
我能做什么


谢谢

我认为您需要注释掉或删除以下委托函数

 override func tableView(_ tableView: UITableView, sectionForSectionIndexTitle title: String, at index: Int) -> Int
    {
        let temp = indexOfNumbers as NSArray
        return temp.index(of: title)
    }