这是我的UIViewController
:
class HabitTableViewController: UIViewController, UITableViewDataSource, UITableViewDelegate{
@IBOutlet weak var habitTableView: UITableView!
private var _numOfRowsInSects: [Int] = []
private var _habitsByDaySet = false
private var _habitsBySection:[[Habit]] = []
private var _whatIsToday = -1
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
habitTableView.delegate = self
habitTableView.dataSource = self
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func reloadTableForDay(sender: DayButton){
if sender.tag != getDayOfWeek(-1){
_whatIsToday = sender.tag
self.habitTableView.reloadData() //line of exception
}
else{
_whatIsToday = -1
}
}
// methods of UITableView delegate and data source implemented
}
我在 self.habitTableView.reloadData()
行得到一个 NSInvalidArgumentException
,原因是 -[HabitWiz.HabitTableViewController reloadTableForDay:]: unrecognized selector发送到实例 0x7fb0d351b060
。我不知道这里发生了什么,感谢任何帮助。
最佳答案
解决了。我意识到我的应用程序构建不正确:我插入了几个未执行的 print
语句。所以我只是做了一个干净的构建,现在一切正常。
关于ios - 重新加载 UITableView 时出现 NSInvalidArgumentException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32332726/