0

Imagine the app is running and you press the iphone button (the phone button) and you exit the app. then you tap on the app again to enter the app. My problem is that when ever the user does this I want the viewWillAppear or viewDidAppear functions to be called, but unfortunately none of these functions gets called.

I want to know if these function won't get called, then what is the function that is called when the app is appearing again?

4

2 に答える 2

2

- (void)applicationDidBecomeActive:(UIApplication *)applicationあなたはどうUIApplicationDelegateですか?

于 2012-02-09T07:15:31.363 に答える
0

UIApplicationDelegate を見てください。-applicationDidBecomeActive: 探しているものです。

クラスで通知を登録することもできます (UIApplicationDidBecomeActiveNotification)。これは、たとえば、各ビュー コントローラーがそれ自体を管理できるため、アプリのデリゲートにすべてを処理させるよりも実装が簡単な場合があります。

(NSNotificationCenter の -addObserver:selector:name:object: を使用して登録します。通常は -dealloc で、オブジェクトのクリーンアップ中に登録を解除することを忘れないでください。)

于 2012-02-09T07:18:35.167 に答える