-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMapFlipViewController.cs
More file actions
74 lines (64 loc) · 2 KB
/
MapFlipViewController.cs
File metadata and controls
74 lines (64 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.IO;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.CoreLocation;
namespace Monospace2
{
public class MapFlipViewController : UIViewController
{
MapViewController mapView;
MapLocationViewController locationView;
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
mapView = new MapViewController(this);
mapView.View.Frame = new RectangleF(0,0,this.View.Frame.Width, this.View.Frame.Height);
this.View.AddSubview(mapView.View);
}
public void Flip(CLLocationCoordinate2D toLocation)
{
mapView.SetLocation(toLocation); // assume not null, since it's created in ViewDidLoad ??
Flip();
}
public void Flip()
{
// lazy load the non-default view
if (locationView == null)
{
locationView = new MapLocationViewController(this);
locationView.View.Frame = new RectangleF(0,0,this.View.Frame.Width, this.View.Frame.Height);
}
Console.WriteLine("Flip");
UIView.BeginAnimations("Flipper");
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();
}
}
}