我正在尝试使用applicationDidBecomeActive方法(和类似的方法) - 我可以在ObjC中找到大量示例,但在Monotouch中没有。 在AppDelegate和UIViewController中尝试了覆盖,但编译器找不到合适的方法来覆盖。那么,我该如何使用它呢? 我想使用它(与计时器和IdleTimerDisabled一起使用)来阻止设备比平时更长时间地进入睡眠状态(这是一个秒表型应用程序)。也许我走错了路。
答案 0 :(得分:2)
在继承自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 )