2012-06-26 33 views
0

我有一個創建日曆的類。其中一種方法會查找用戶點擊的日期,並將其存儲在同一類中的CFGregorianDate對象中。如何獲取不同課程中用戶點擊的通知?

我有一個需要知道在另一個類當用戶點擊日曆日期,但CFGregorianDate對象已更新後,所以我可以做一些後端處理。

如何在第二堂課獲得水龍頭的通知?

回答

2

考慮NSNotificationCenterClass一個選擇..

// add this in your anotherClass 
[[NSNotificationCenter defaultCenter] removeObserver:self]; 
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(objectUpdated:) name:@"objectUpdated" object:nil]; 



//then post notification after you updated the CFGregorianDate 
NSNotificationCenter *ncSubject = [NSNotificationCenter defaultCenter]; 
[ncSubject postNotificationName:@"objectUpdated" object:nil]; 
[ncSubject removeObserver:self]; 
+0

太棒了!我不知道這個班級,非常感謝你! – SpokaneDude

+0

歡迎您:) – janusbalatbat

相關問題