【发布时间】:2017-02-11 03:39:27
【问题描述】:
我的表视图控制器类有以下方法:
func reloadInputFields() {
dispatch_async(dispatch_get_main_queue()) {
self.tableView.beginUpdates()
self.tableView.reloadSections(NSIndexSet(index: 1), withRowAnimation: .Automatic)
self.tableView.endUpdates()
}
}
这是从 NSNotification 调用的。运行时很好地进入了这个方法,并且似乎调用了 reloadSections。然而,它从来没有真正做到过。显然我在这里的主线程上执行,因为它是一个 UI 更新,但我也尝试过在后台线程上。我也试过只打电话给tableView.reloadData()而不是reloadSections,但那里没有快乐。表格视图肯定存在,我检查过指针是否正确。
cellForRowAtIndexPathnumberOfSectionsInTableViewheightForRowAtIndexPathnumberOfRowsInSection 等中的断点未命中且表未重新加载。
我的delegate 和dataSource 设置正确,此处已验证:
我已经为此苦苦挣扎了几个小时,完全胜过我。如有任何建议,我们将不胜感激。
【问题讨论】:
-
是被称为部分的行数吗?
-
不,不是迈克,应该也列出那个。
-
先检查delegate,如果你是拖放表格,则无需分配tableview尝试一次。
-
请尽可能多地展示您的代码。
-
为什么这个问题被否决并投票结束?
标签: ios swift uitableview nsnotificationcenter reloaddata