In my MonoTouch application, I have an βaddβ button, which, after disconnecting, is disabled for the rest of the day. To check and activate the button when the application becomes active, I track the UIApplication.Notifications.ObserveDidBecomeActive in the constructor for the ViewController.
NSObject _didBecomeActiveNotification; . . . // and in constructor _didBecomeActiveNotification = UIApplication.Notifications.ObserveDidBecomeActive((sender, args) => { SetRightBarButtonState(); });
Then I override the Dispose method in ViewController via
protected override void Dispose (bool disposing) { if (disposing) { _didBecomeActiveNotification.Dispose(); } base.Dispose (disposing); }
source share