我正在開發電子書閱讀器,並遇到以下問題。我正在使用一個IBAction方法來發佈一個NSNotification,它一旦點擊一個按鈕就會調用一個動作方法。第一次工作絕對正常...... IBAction方法必須被稱爲evry time,我點擊按鈕。完成這個動作之後,我需要進入我的主頁,然後回來再次單擊按鈕。這是我面臨的問題。該方法獲取調用不止一次從第二次和數量只有不斷增加。請幫我這個....NSNotification正在多次提出
//IBAction Method
if (sender.tag == PenToolAction) {
GLogInfo(@"Pen tool tapped");
[self hideSelf];
[[NSNotificationCenter defaultCenter] postNotificationName:PenToolActionInitialized object:nil];
}
你把`[[NSNotificationCenter defaultCenter] addObserver :. ..]電話? – Jilouc 2011-02-02 09:51:38
我已經把它放在了接收器類的ViewDidLoad方法中。 – 2011-02-02 13:17:44