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 static UIImage ImageFromColor(UIColor color, CGRect bounds) | |
| { | |
| UIGraphics.BeginImageContextWithOptions(bounds.Size,false,0); | |
| color.SetFill(); | |
| UIGraphics.RectFill(bounds); | |
| var image = UIGraphics.GetImageFromCurrentImageContext(); | |
| UIGraphics.EndImageContext(); | |
| return image; | |
| } |
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
| // Xamarin.iOS (using MonoTouch.UIKit;) | |
| static Random rand = new Random(); | |
| public static UIColor GetRandomColor() { | |
| int hue = rand.Next(255); | |
| UIColor color = UIColor.FromHSB( | |
| (hue / 255.0f), | |
| 1.0f, | |
| 1.0f); | |
| return color; | |
| } |
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 static void Fade (this UIView view, bool isIn, double duration = 0.3, Action onFinished = null) | |
| { | |
| var minAlpha = (nfloat)0.0f; | |
| var maxAlpha = (nfloat)1.0f; | |
| view.Alpha = isIn ? minAlpha : maxAlpha; | |
| view.Transform = CGAffineTransform.MakeIdentity (); | |
| UIView.Animate (duration, 0, UIViewAnimationOptions.CurveEaseInOut, | |
| () => { | |
| view.Alpha = isIn ? maxAlpha : minAlpha; |
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
| [Register("PieProgressView")] | |
| public class PieProgressView: UIView | |
| { | |
| private float _pieWidth; | |
| private float _progress; | |
| public float Progress | |
| { | |
| get { return _progress; } |