Swift tableView.reloadData()然后出现致命错误:索引超出范围
然后 当更新(tableView.reloadData())->致命错误时: 索引超出范围Swift tableView.reloadData()然后出现致命错误:索引超出范围,swift,reloaddata,removeall,Swift,Reloaddata,Removeall,然后 当更新(tableView.reloadData())->致命错误时: 索引超出范围 告诉我我的错误是什么?你能告诉我们你的“NumberOfRowInstition”方法吗?强烈建议不要使用Swift类型(Array)作为变量名确保“NumberOfRowSection”返回“Array.count”数组名例如滚动更新表视图并确定!在tableView.reloadData()中出现错误 var Array = [String]() NSTimer.scheduledTimerWi
告诉我我的错误是什么?你能告诉我们你的“NumberOfRowInstition”方法吗?强烈建议不要使用Swift类型(
Array
)作为变量名确保“NumberOfRowSection”返回“Array.count”数组名例如滚动更新表视图并确定!在tableView.reloadData()中出现错误
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
}