AngryHacker
AngryHacker

Reputation: 61636

How to detect when the control has moved to the view in MonoTouch?

I have View1 and View2. In View1, I call the following to get to View2:

View2 pl = new View2();
this.NavigationController.PushViewController(pl, true);

View2 loads fine. Then in View2, I call code to get back to View1:

this.NavigationController.PopViewControllerAnimated(true);

How do I detect in View1 that it is now once again the active view? I can't seem anything obvious to override. I'll take the answer in either MonoTouch or XCode paradigms.

Upvotes: 0

Views: 51

Answers (1)

Eduardo Scoz
Eduardo Scoz

Reputation: 24753

I assume in your code View1 and View2 are subclasses of UIViewController, and now UIView, is that correct?

If so, you can override the ViewWillAppear on V1, and that will get called just before View2's animation to disappear starts:

 public override void ViewWillAppear(bool animated) {}

Upvotes: 2

Related Questions