2013-02-26 52 views
0

我有一個視圖控制器基於UITableViewController,我想收到更新通知時重新加載表視圖:刷新表視圖時收到通知

我張貼在其他類通知:

[[NSNotificationCenter defaultCenter] postNotificationName:@"UpdateApStatus" object:self]; 

錯誤是:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MenuViewController updateApStatus:]: unrecognized selector sent to instance 0xb25bf80' 

好像我無法訪問self

回答

1

updateApStatus中刪除「:」。如果函數的參數不是這樣,那麼只會使用冒號。因此,添加冒號是完全不同的選擇器,這是它無法識別的原因。

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateApStatus) name:@"UpdateApStatus" object:nil];