tableView.reloadData()然后致命错误:索引超出范围

时间:2016-12-25 16:18:22

标签: swift reloaddata removeall

var Array = [String]()  

NSTimer.scheduledTimerWithTimeInterval(1.0, target: self, selector: #selector(ViewController.func), userInfo: nil, repeats: true)

func(){
    Array.removeAll()
    ...
    for value in data{
        ...
        Array.append(string_value)
        ...
    }
    ...
    tableView.reloadData()
}

然后

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCel{

      cell.label.text = Array[indexPath.row]
      return cell

}

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

当更新(tableView.reloadData()) - >致命错误:

  

指数超出范围

告诉我我的错误是什么?

0 个答案:

没有答案