Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
iOS 8 Visual Effects using Xamarin
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.