diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa1edd3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.userprefs +*/bin +*.pidb diff --git a/FlipView/BackViewController.xib.cs b/FlipView/BackViewController.xib.cs index 7bc33f4..8dc3d5e 100644 --- a/FlipView/BackViewController.xib.cs +++ b/FlipView/BackViewController.xib.cs @@ -43,12 +43,14 @@ public override void ViewDidLoad () { base.ViewDidLoad (); - UIImage image = UIImage.FromFile("notjohnskeet.jpg"); - UIImageView firstImage = new UIImageView(image); - image.Dispose(); - firstImage.Frame = UIScreen.MainScreen.Bounds; - this.View.AddSubview(firstImage); - firstImage.Dispose(); + using(UIImage image = UIImage.FromFile("notjohnskeet.jpg")) + { + using(UIImageView secondImageView = new UIImageView(image)) + { + secondImageView.Frame = UIScreen.MainScreen.Bounds; + this.View.AddSubview(secondImageView); + } + } } public override void TouchesBegan (NSSet touches, UIEvent evt) diff --git a/FlipView/Default.png b/FlipView/Default.png new file mode 100644 index 0000000..2a34836 Binary files /dev/null and b/FlipView/Default.png differ diff --git a/FlipView/FlipView.csproj b/FlipView/FlipView.csproj index 6c3509c..3efb54b 100644 --- a/FlipView/FlipView.csproj +++ b/FlipView/FlipView.csproj @@ -96,5 +96,7 @@ + + \ No newline at end of file diff --git a/FlipView/FrontViewController.xib.cs b/FlipView/FrontViewController.xib.cs index c6e2ac4..9a6d959 100644 --- a/FlipView/FrontViewController.xib.cs +++ b/FlipView/FrontViewController.xib.cs @@ -41,12 +41,14 @@ public override void ViewDidLoad () { base.ViewDidLoad (); - UIImage image = UIImage.FromFile("johnskeet.jpg"); - UIImageView firstImage = new UIImageView(image); - image.Dispose(); - firstImage.Frame = UIScreen.MainScreen.Bounds; - this.View.AddSubview(firstImage); - firstImage.Dispose(); + using(UIImage image = UIImage.FromFile("johnskeet.jpg")) + { + using(UIImageView firstImage = new UIImageView(image)) + { + firstImage.Frame = UIScreen.MainScreen.Bounds; + this.View.AddSubview(firstImage); + } + } } public override void TouchesBegan (NSSet touches, UIEvent evt) @@ -54,9 +56,25 @@ public override void TouchesBegan (NSSet touches, UIEvent evt) base.TouchesBegan (touches, evt); BackViewController bvc = new BackViewController(this); - bvc.ModalTransitionStyle = UIModalTransitionStyle.FlipHorizontal; + bvc.ModalTransitionStyle = GetRandomTransitionStyle(); PresentModalViewController(bvc, true); } + + private UIModalTransitionStyle GetRandomTransitionStyle() + { + Random random = new Random(); + switch(random.Next(0, 3)) + { + default: + case 0: + return UIModalTransitionStyle.FlipHorizontal; + case 1: + return UIModalTransitionStyle.CrossDissolve; + case 2: + return UIModalTransitionStyle.CoverVertical; + } + } + diff --git a/FlipView/Icon.png b/FlipView/Icon.png new file mode 100644 index 0000000..98a851c Binary files /dev/null and b/FlipView/Icon.png differ