I've seen it when you Pop animated and then push immediately afterwards, or when you pop twice in a row. Usually corrupts the navigation bar (as in the title will not match the view etc.
In this case I am describing, I can't be 100% certain whether it was going to show a new view or display a uiactionsheet after it popped, but it was one or the other. Dino From: René Ruppert [mailto:[email protected]] Sent: Sunday, April 15, 2012 6:40 To: Dean Cleaver; [email protected] Subject: AW: [MonoTouch] Nested push animations Can somebody comment WHEN these problems with nested animations occur? I'm animating controller views left and right in my own view controller containment implementation (a split view clone) and have never seen these problems when animating views manually. However I noticed once that I got an exception that informed that a transition to another controller cannot be started while one is still running. Where's the difference between manual view animation and using controller's transitions? René Von: [email protected]<mailto:[email protected]> [mailto:[email protected]]<mailto:[mailto:[email protected]]> Im Auftrag von Dean Cleaver Gesendet: Samstag, 14. April 2012 02:23 An: [email protected]<mailto:[email protected]> Betreff: Re: [MonoTouch] Nested push animations Worked it out in the end. You can do it this way: using MonoTouch.UIKit; namespace Your.Namespace { public class NavigationControllerDelegate : UINavigationControllerDelegate { public bool Transitioning = true; public override void DidShowViewController (UINavigationController navigationController, UIViewController viewController, bool animated) { this.Transitioning = false; } } } And do this on each PopViewControllerAnimated: NavigationControllerDelegate navigationControllerDelegate = new NavigationControllerDelegate(); navigationController.Delegate = navigationControllerDelegate; navigationController.PopViewControllerAnimated(true); while (navigationControllerDelegate.Transitioning) NSRunLoop.Current.RunUntil(DateTime.Now.AddMilliseconds(50)); navigationController.Delegate = null; But rather than do that everywhere, I created this extension method (using the above delegate class): using System; using MonoTouch.Foundation; using Your.Namespace; namespace MonoTouch.UIKit { public static class NavigationControllerExtension { public static UIViewController PopViewControllerAnimatedPause(this UINavigationController navigationController, bool animated) { if (animated) { NavigationControllerDelegate existing = navigationController.Delegate ; NavigationControllerDelegate navigationControllerDelegate = new NavigationControllerDelegate(); navigationController.Delegate = navigationControllerDelegate; UIViewController result = navigationController.PopViewControllerAnimated(true); while (navigationControllerDelegate.Transitioning) NSRunLoop.Current.RunUntil(DateTime.Now.AddMilliseconds(50)); navigationController.Delegate = existing; return result; } return navigationController.PopViewControllerAnimated(false); } } } Now all I have to do is call "PopViewControllerAnimatedPause(true);" and it's all handled for me. Dino From: [email protected]<mailto:[email protected]> [mailto:[email protected]]<mailto:[mailto:[email protected]]> On Behalf Of Dean Cleaver Sent: Friday, April 13, 2012 1:42 PM To: [email protected]<mailto:[email protected]> Subject: [MonoTouch] Nested push animations Hi, I'm getting some nested push animation errors when transitioning between screens, and I'm not sure how I can prevent it nicely. Basically: 1. I push a screen that the user fills in. 2. I pop the screen animated. 3. I call other code that depending on circumstances, may or may not show a UIActionSheet or another UIView animated. On showing the UIActionSheet or UIView I get the nested animation problems. Now, I can pop the screen not animated in step 2, but it looks rather abrupt if step 3 doesn't show any other UI elements. What I'm looking for is a way to detect that the pop in step 2 has completed before I continue with step 3 - is there an easy way to detect that its completed? Dino
_______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
