Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

iOS 8 Visual Effects using Xamarin

View EffectsController.cs
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
using System;
using System.Drawing;
using MonoTouch.UIKit;
 
namespace ViewEffectsDemo
{
public class EffectsController : UIViewController
{
UIImageView imageView;
UIScrollView scrollView;
UILabel label;
 
public override void ViewDidLoad ()
{
imageView = new UIImageView ();
 
using (var image = UIImage.FromFile ("monkey.jpg")) {
imageView.Image = image;
imageView.Frame = new RectangleF (0, 0, image.Size.Width, image.Size.Height);
}
 
scrollView = new UIScrollView (View.Frame) {
ContentSize = imageView.Image.Size
};
 
scrollView.Add (imageView);
 
View.Add (scrollView);
 
// blur view
var blur = UIBlurEffect.FromStyle (UIBlurEffectStyle.Light);
var blurView = new UIVisualEffectView (blur) {
Frame = new RectangleF (0, 0, imageView.Frame.Width, 400)
};
 
View.Add (blurView);
 
// vibrancy view
var frame = new Rectangle (10, 10, 100, 50);
var vibrancy = UIVibrancyEffect.FromBlurEffect (blur);
var vibrancyView = new UIVisualEffectView (vibrancy) {
Frame = frame
};
 
label = new UILabel {
Text = "Hello iOS 8!",
Frame = vibrancyView.Bounds
};
 
vibrancyView.ContentView.Add (label);
blurView.ContentView.Add (vibrancyView);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.