在應用我的工作,我有動作片,並且當應用程序進入非激活/後臺狀態我想解僱警報意見。解僱UIActionSheet當應用程序在雲上的背景iOS4的
我使用UIApplicationWillResignActiveNotification而不是UIApplicationDidEnterBackgroundNotification,因爲我希望代碼與iOS3.2兼容。
-(void)applicationWillResignActive:(Notification *)notification{
if (self.actionSheet && self.actionSheet.visible){
NSLog(@" actionSheet is Visible");
[self.actionSheet dismissWithClickedButtonIndex:0 animated:NO];
}
}
測試這模擬器(iPhone 3.2,iOS4的),與actionSheet可見,我按下home鍵,但我不明白的「actionSheet可見」的消息。然而,當我重新打開應用程序並使用主頁按鈕再次解除它時,我得到「actionSheet is Visible」消息。
這表明首次actionSheet的Visible屬性未被設置。這套房產能否延期?事實上,我在顯示動作的方法中加入了一條消息
[self.actionSheet showInView:self.parentViewController.tabBarController.view];
if (self.actionSheet.Visible) NsLog(@" action Sheet visible");
即使在這裏,我也沒有收到消息。可見屬性設置在何處/何時?我在試圖解僱actionSheet時做了一些根本性錯誤?我已經看到類似的非常好的和詳細的解決方案,關閉SO中的alertViews ....但他們似乎不涉及這個問題。任何幫助都感激不盡。
爲什麼你關心在iOS 3.2駁回動作片?該應用程序將在用戶退出時被終止,因此無關緊要。你不如使用'UIApplicationWillResignActiveNotification'。 – 2010-08-14 01:54:38
嗨,我同意我不需要對iOS3.2中的actionSheet做任何事情。但我的問題是在iOS4。 對不起,我應該寫在我的消息上面的iPhone3G而不是iPhone 3.2。 – prd 2010-08-14 22:14:46