Skip to content

Commit

Permalink
Updated to have random transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisntr committed Nov 15, 2009
1 parent 4d66c7e commit 50fb5a1
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
*.userprefs
*/bin
*.pidb
14 changes: 8 additions & 6 deletions FlipView/BackViewController.xib.cs
Expand Up @@ -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)
Expand Down
Binary file added FlipView/Default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions FlipView/FlipView.csproj
Expand Up @@ -96,5 +96,7 @@
<ItemGroup>
<Content Include="johnskeet.jpg" />
<Content Include="notjohnskeet.jpg" />
<Content Include="Default.png" />
<Content Include="Icon.png" />
</ItemGroup>
</Project>
32 changes: 25 additions & 7 deletions FlipView/FrontViewController.xib.cs
Expand Up @@ -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;
}
}




Expand Down
Binary file added FlipView/Icon.png
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.