在從UIApplicationDelegate
繼承了您的應用程序委託,您可以重寫這些:
/// <summary>
/// Gets called by iOS if the app is started from scratch and is not resumed from background.
/// We have 17 seconds to leave this methos before iOS will kill the app.
/// </summary>
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
/// <summary>
/// Called if the app comes back from background or gets started. Triggered after FinishedLaunching().
/// </summary>
public override void OnActivated (UIApplication application)
/// <summary>
/// Called if the application gets pushed to the background because the user hits the home button.
/// </summary>
public override void DidEnterBackground (UIApplication application)
/// <summary>
/// Gets called if the app is resumed from background but NOT if the app starts first time.
/// </summary>
public override void WillEnterForeground (UIApplication application)
感謝。其實我想我問了一個錯誤的問題,因爲每次按下按鈕時都需要刷新計時器,以保持設備的喚醒時間比平常長。這些覆蓋不會捕獲正確的事件,但你讓我走上了正確的軌道 - 現在我已經重寫了TouchUpInside,用於關鍵ViewController中的所有按鈕。 – quilkin