-
-
Save phaufe/6817641 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using MonoTouch.UIKit; | |
using MonoTouch.CoreAnimation; | |
namespace XamarinStore | |
{ | |
public class BrightlyBlurredUIView: UIView | |
{ | |
CALayer blurLayer,accentLayer; | |
UIView accentView; | |
UIToolbar toolbar; | |
public BrightlyBlurredUIView() | |
{ | |
toolbar = new UIToolbar { | |
Opaque = true, | |
}; | |
this.Layer.AddSublayer(blurLayer = toolbar.Layer); | |
accentView = new UIView { | |
BackgroundColor = this.TintColor, | |
Alpha = .7f, | |
Opaque = false | |
}; | |
blurLayer.InsertSublayer(accentLayer = accentView.Layer,1); | |
this.Layer.MasksToBounds = true; | |
this.BackgroundColor = UIColor.Clear; | |
} | |
public override void LayoutSubviews () | |
{ | |
base.LayoutSubviews (); | |
var bounds = Bounds; | |
accentLayer.Frame = blurLayer.Frame = bounds; | |
} | |
public float AccentColorIntensity | |
{ | |
get{ return accentView.Alpha; } | |
set{ accentView.Alpha = value; } | |
} | |
public override UIColor TintColor { | |
get { | |
return base.TintColor; | |
} | |
set { | |
base.TintColor = toolbar.BarTintColor = accentView.BackgroundColor = value; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment