我在使用重裝數據刷新我的UITableView時遇到問題。ReloadData不刷新列表
作爲一個快速描述: 這個類收到NSNotification包含對象與數據需要添加到列表和設備必須震動一次,表明數據收到。設備本身振動,但列表沒有更新,所以沒有新的數據添加到列表中。收到通知時
代碼:
dispatch_async(dispatch_get_main_queue(), {
let object = notification.object as! Attendee
self.handshakesArray.append(object)
self.tableViewMain.reloadData()
AudioServicesPlayAlertSound(UInt32(kSystemSoundID_Vibrate))
})
我不知道這是一個iOS的問題,或者我的實現是錯誤的。
編輯:
class Shakes: UITableViewController {
private var handshakesArray = [Attendee]()
override func viewDidLoad() {
super.viewDidLoad()
}
func executeTask(notification:NSNotification) {
dispatch_async(dispatch_get_main_queue(), {
let object = notification.object as! Attendee
self.handshakesArray.append(object)
self.tableViewMain.reloadData()
AudioServicesPlayAlertSound(UInt32(kSystemSoundID_Vibrate))
})
}
// ........
}
在此先感謝
是我編輯我的問題 – Melchior