MonoTouch
When an app is brought back to the foreground, I need the ViewController that becomes active to know about this.
Is there an event or override I can use to determine that the view was brought to the foreground.
I did find "WillEnterForegroundNotification" but it's a String, so am not sure how it's used.
I found this:
Put this in the CTOR of the ViewController:
NSNotificationCenter.DefaultCenter.AddObserver (UIApplication.WillEnterForegroundNotification,
EnterForeground);
Create then this method to handle the event in the view controller.
void EnterForeground (NSNotification notification)
{
Console.WriteLine("EnterForeground: " + notification.Name);
}
Note: When your app is brought to the foreground, the UIApplicationDelegate will get this raised first, a good place to clear things like login details and security related checks.
public override void WillEnterForeground (UIApplication application)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With