MonoTouch的
当应用程序返回到前台时,我需要处于活动状态的ViewController来了解这一点.
是否有事件或覆盖我可以用来确定视图被带到前台.
我确实找到了“WillEnterForegroundNotification”,但它是一个String,所以我不确定它是如何使用的.
解决方法
我找到了这个:
把它放在ViewController的CTOR中:
NSNotificationCenter.DefaultCenter.Addobserver (UIApplication.WillEnterForegroundNotification,EnterForeground);
然后创建此方法以处理视图控制器中的事件.
void EnterForeground (NSNotification notification) { Console.WriteLine("EnterForeground: " + notification.Name); }
注意:当您的应用程序被带到前台时,UIApplicationDelegate将首先获得此项,这是清除登录详细信息和安全相关检查等内容的好地方.
public override void WillEnterForeground (UIApplication application)