我有iOS應用程序中的對象列表,它使用NSNotificationCenter
觀察一些更改。NSNotificationCenter更改觀察者訂單
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onSomeChanges)
name:@"SomeConstantNotificatioName" object:nil];
所以當通知發佈,NSNotificationCenter
調用以相同的順序onSomeChanges
方法爲addObserver
調用方法。
問題是有沒有辦法改變這個順序?
我需要的是能夠調用一些添加觀察者方法,它將插入需要的觀察者作爲觀察者列表的第一個元素。因此,無論觀察者添加的順序如何,某個對象都會首先收到通知。
謝謝
可能dupliacte http://stackoverflow.com/questions/12957590/nsnotification-order-of-observer-notifications –