我因range
错误而遇到麻烦...
错误发生在cell.creditLabel.text = numOfDays[(indexPath as NSIndexPath).row] + "days"
.
如果我tableView.reloadData()
把cell.nameLabel.text = nameArray[(indexPath as NSIndexPath).row]
然后模拟器中什么都没有显示...
我该如何解决这个问题..?
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.nameArray.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell : MoneyTableViewCell = tableView.dequeueReusableCell(withIdentifier: "MoneyTableViewCell", for: indexPath) as! MoneyTableViewCell
cell.nameLabel.text = nameArray[(indexPath as NSIndexPath).row]
cell.creditLabel.text = numOfDays[(indexPath as NSIndexPath).row] + "days"
cell.levelLabel.text = creditArray[(indexPath as NSIndexPath).row]
cell.layoutIfNeeded()
return cell
}