Monospace22.zip (188Kb)
The view is driven by the
MapFlipViewController
(which is what we add to the TabViewController
). It is responsible for creating/displaying the two 'flippable' views using UIView
animation features.The two views -
MapViewController
& MapLocationViewController
- have a constructor which accepts a reference to the 'flipper' so they can call back to it's Flip()
method, which looks something like this...UIView.BeginAnimations("Flipper");There is other code to actually set the map to a specific location - but that's actually pretty simple :)
UIView.SetAnimationDuration(1.25);
UIView.SetAnimationCurve(UIViewAnimationCurve.EaseInOut);
if (mapView.View.Superview == null)
{
Console.WriteLine("to map");
UIView.SetAnimationTransition
(UIViewAnimationTransition.FlipFromRight, this.View, true);
locationView.ViewWillAppear(true);
mapView.ViewWillDisappear(true);
locationView.View.RemoveFromSuperview();
this.View.AddSubview(mapView.View);
mapView.ViewDidDisappear(true);
locationView.ViewDidAppear(true);
}
else
{
Console.WriteLine("to list");
UIView.SetAnimationTransition
(UIViewAnimationTransition.FlipFromLeft, this.View, true);
mapView.ViewWillAppear(true);
locationView.ViewWillDisappear(true);
mapView.View.RemoveFromSuperview();
this.View.AddSubview(locationView.View);
locationView.ViewDidDisappear(true);
mapView.ViewDidAppear(true);
}
UIView.CommitAnimations();
mapView.SetLocation(toLocation);
Thanks Craig your experimentations with MonoTouch is surely helping me to grasp a lot more of the Cocoa Touch concepts underneath MonoTouch.
ReplyDeleteCraig,
ReplyDeleteThanks for posting the info. It looks like the links aren't working, however, to the source?
Steve
Hey Steve, I'll check out the server where the code is hosted... Should probably put on googlecode or git at some point.
ReplyDeleteThanks for reading:)
UPDATE: code download link should be working again.
ReplyDeleteMonospace22.zip (188Kb)
Craig, I'm using similar code myself. One thing I have found is that this seems to break the rotaition handling. The two controllers that are flipped no longer rotate correctly. What I've had to do is add an observer on the flipcontroller for OrientationDidChangeNotification and within that call controller1.View.SetNeedsLayout() and controller2.View.SetNeedsLayout(). But then any controllers those controllers invoke don't rotate properly.
ReplyDeleteIf I don't use the flip controllers but just push them directly, they rotate fine so definitely seems to be the flipcontroller causing the problem.
I am wondering if you had same issue. I tried to run your app but its failing when I start it up.
Hi,It looks like the links aren't working.
ReplyDelete