Created
January 5, 2018 03:07
-
-
Save sjehutch/da1408c52255fd3836909893715aed4f to your computer and use it in GitHub Desktop.
xamarin IOS gradient view
This file contains hidden or 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
| public void GradientHelper (UIColor colorOne , UIColor colorTwo , UIView myView) | |
| { | |
| var gradientLayer = new CAGradientLayer(); | |
| myView.Frame = myView.Bounds; | |
| gradientLayer.Colors = gradientLayer.Colors = new[] { colorOne.CGColor, colorTwo.CGColor }; | |
| gradientLayer.Locations = new NSNumber[] { 0, 1 }; | |
| gradientLayer.StartPoint = new CoreGraphics.CGPoint(x: 1.0, y:1.0); | |
| gradientLayer.EndPoint = new CoreGraphics.CGPoint(x: 0.0, y: 0.0); | |
| myView.Layer.InsertSublayer(gradientLayer,0); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment