Permalink
Browse files

Updated to have random transitions

  • Loading branch information...
1 parent 4d66c7e commit 50fb5a1cfa2f90c8ccfaa789af4f92b04d5b76e7 @chrisntr committed Nov 15, 2009
View
@@ -0,0 +1,3 @@
+*.userprefs
+*/bin
+*.pidb
@@ -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)
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -96,5 +96,7 @@
<ItemGroup>
<Content Include="johnskeet.jpg" />
<Content Include="notjohnskeet.jpg" />
+ <Content Include="Default.png" />
+ <Content Include="Icon.png" />
</ItemGroup>
</Project>
@@ -41,22 +41,40 @@ 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)
{
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;
+ }
+ }
+
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 50fb5a1

Please sign in to comment.