本文整理汇总了C#中UIKit.UIColor类的典型用法代码示例。如果您正苦于以下问题:C# UIColor类的具体用法?C# UIColor怎么用?C# UIColor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIColor类属于UIKit命名空间,在下文中一共展示了UIColor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateLinearGauge
void CreateLinearGauge()
{
this.linearGauge = new TKLinearGauge();
this.linearGauge.WeakDelegate = this.gaugeDelegate;
this.linearGauge.Orientation = TKLinearGaugeOrientation.Vertical;
this.View.AddSubview(this.linearGauge);
TKGaugeLinearScale scale = new TKGaugeLinearScale (new NSNumber(-10), new NSNumber(40));
this.linearGauge.AddScale (scale);
TKGaugeSegment segment = new TKGaugeSegment (new NSNumber(-10), new NSNumber(18));
segment.Location = 0.56f;
segment.Width = 0.05f;
segment.Width2 = 0.05f;
segment.Cap = TKGaugeSegmentCap.Round;
scale.AddSegment (segment);
UIColor[] colors = new UIColor[] {
new UIColor (0.149f, 0.580f, 0.776f, 1.00f),
new UIColor (0.537f, 0.796f, 0.290f, 1.00f),
new UIColor (1.000f, 0.773f, 0.247f, 1.00f),
new UIColor (1.000f, 0.463f, 0.157f, 1.00f),
new UIColor (0.769f, 0.000f, 0.047f, 1.00f)
};
this.AddSegments(scale, colors, 0.5f, 0.05f);
}
示例2: FAButton
/// <summary>
/// Initializes a new instance of the <see cref="FontAwesomeXamarin.FAButton"/> class.
/// This class extends UIButton. It does set set a default Frame. You must do this yourself
/// </summary>
/// <param name="icon">Icon.</param>
/// <param name="fontColor">Font color.</param>
/// <param name="iconSize">Icon size.</param>
public FAButton (string icon, UIColor fontColor, float iconSize = 20) : base(UIButtonType.System)
{
Icon = icon;
IconSize = iconSize;
this.SetTitleColor (fontColor, UIControlState.Normal);
this.SetTitleColor (fontColor.ColorWithAlpha(100), UIControlState.Highlighted);
}
示例3: AddBorder
public static void AddBorder(this UIView view, UIRectEdge edge, UIColor color, nfloat thickness) {
var border = new CALayer ();
var f = view.Frame;
switch(edge)
{
case UIRectEdge.Top:
border.Frame = new CGRect(0, 0, f.Width, thickness);
break;
case UIRectEdge.Bottom:
border.Frame = new CGRect (0, f.Height - thickness, f.Width, thickness);
break;
case UIRectEdge.Left:
border.Frame = new CGRect(0, 0, thickness, f.Height);
break;
case UIRectEdge.Right:
border.Frame = new CGRect(f.Width - thickness, 0, thickness, f.Height);
break;
default:
break;
}
border.BackgroundColor = color.CGColor;
view.Layer.AddSublayer (border);
}
示例4: SetCornerBackgroundColor
public void SetCornerBackgroundColor(UIColor color)
{
if (color != CornerBackgroundColor) {
CornerBackgroundColor = color;
SetNeedsDisplay();
}
}
示例5: Create
public static FavoriteNodeView Create (CGRect frame, NodeViewController nodeViewController, UIColor kleur)
{
var view = (FavoriteNodeView)Nib.Instantiate (null, null) [0];
view.Frame = frame;
view.SetShadow();
view._nodeViewController = nodeViewController;
view.NodeItemTableController.RefreshControl = new UIRefreshControl()
{
TintColor = UIColor.FromRGB(143, 202, 232),
AttributedTitle = new NSAttributedString("Map aan het verversen")
};
view.NodeItemTableController.RefreshControl.ValueChanged += delegate
{
view.Refresh();
};
view.SyncButton.TouchUpInside += delegate
{;
view.Refresh(scrollToTop: true);
};
if (kleur != null)
{
view.KleurenBalk.BackgroundColor = kleur;
}
view.Refresh(scrollToTop: true);
return view;
}
示例6: CellDisclosureAccessory
public CellDisclosureAccessory(CGRect frame)
: base(frame)
{
this.BackgroundColor = UIColor.Clear;
this.color = App.ForegroundColor.ToUIColor();
this.highlightedColor = App.NavigationColor.ToUIColor();
}
示例7: Create
public static BaseItemView Create (CGRect frame, NodeViewController nodeViewController, TreeNode node, string filePath, UIColor kleur)
{
var view = BaseItemView.Create(frame, nodeViewController, node, kleur);
UIWebView webView = new UIWebView();
string extension = Path.GetExtension (filePath);
if (extension == ".odt") {
string viewerPath = NSBundle.MainBundle.PathForResource ("over/viewer/index", "html");
Uri fromUri = new Uri(viewerPath);
Uri toUri = new Uri(filePath);
Uri relativeUri = fromUri.MakeRelativeUri(toUri);
String relativePath = Uri.UnescapeDataString(relativeUri.ToString());
NSUrl finalUrl = new NSUrl ("#" + relativePath.Replace(" ", "%20"), new NSUrl(viewerPath, false));
webView.LoadRequest(new NSUrlRequest(finalUrl));
webView.ScalesPageToFit = true;
view.ContentView = webView;
return view;
} else {
NSUrl finalUrl = new NSUrl (filePath, false);
webView.LoadRequest(new NSUrlRequest(finalUrl));
webView.ScalesPageToFit = true;
view.ContentView = webView;
return view;
}
}
示例8: CreateRadialGauge
void CreateRadialGauge()
{
this.radialGauge = new TKRadialGauge ();
this.View.AddSubview (this.radialGauge);
TKGaugeRadialScale scale = new TKGaugeRadialScale ();
this.radialGauge.AddScale (scale);
scale.StartAngle = 0;
scale.EndAngle = (nfloat)Math.PI*2.0f;
scale.Stroke = new TKStroke (UIColor.Clear);
scale.Ticks.Hidden = true;
scale.Labels.Hidden = true;
for (int i=0; i < 3; i++) {
TKGaugeSegment segment = new TKGaugeSegment (new NSNumber (0), new NSNumber (100));
segment.Fill = new TKSolidFill(this.colors[i].ColorWithAlpha(0.4f));
segment.Width = 0.2f;
segment.Location = 0.5f + i * 0.25f;
segment.Cap = TKGaugeSegmentCap.Round;
scale.AddSegment(segment);
TKGaugeSegment gradientSegment = new TKGaugeSegment ();
UIColor[] colors = new UIColor[] { this.colors[i], this.colors [i + 3] };
gradientSegment.Fill = new TKLinearGradientFill (colors, new CGPoint(0.0f, 0.0f), new CGPoint(1.0f, 1.0f));
gradientSegment.Width = 0.2f;
gradientSegment.Location = 0.5f + i * 0.25f;
gradientSegment.Cap = TKGaugeSegmentCap.Round;
scale.AddSegment (gradientSegment);
gradientSegment.SetRange(new TKRange(new NSNumber(0), new NSNumber(20+ this.r.Next(50)) ), 0.5f, CAMediaTimingFunction.EaseInEaseOut);
}
}
示例9: ImageFromFont
public static UIImage ImageFromFont(string text, UIColor iconColor, CGSize iconSize, string fontName)
{
UIGraphics.BeginImageContextWithOptions(iconSize, false, 0);
var textRect = new CGRect(CGPoint.Empty, iconSize);
var path = UIBezierPath.FromRect(textRect);
UIColor.Clear.SetFill();
path.Fill();
var font = UIFont.FromName(fontName, iconSize.Width);
using (var label = new UILabel() { Text = text, Font = font })
{
GetFontSize(label, iconSize, 500, 5);
font = label.Font;
}
iconColor.SetFill();
using (var nativeString = new NSString(text))
{
nativeString.DrawString(textRect, new UIStringAttributes
{
Font = font,
ForegroundColor = iconColor,
BackgroundColor = UIColor.Clear,
ParagraphStyle = new NSMutableParagraphStyle
{
Alignment = UITextAlignment.Center
}
});
}
var image = UIGraphics.GetImageFromCurrentImageContext();
UIGraphics.EndImageContext();
image = image.ImageWithRenderingMode (UIImageRenderingMode.AlwaysOriginal);
return image;
}
示例10: GlassButton
/// <summary>
/// Creates a new instance of the GlassButton using the specified dimensions
/// </summary>
public GlassButton(CGRect frame)
: base(frame)
{
NormalColor = new UIColor(0.55f, 0.04f, 0.02f, 1);
HighlightedColor = UIColor.Black;
DisabledColor = UIColor.Gray;
}
示例11: ToUIColorOrDefault
/// <summary>
/// Converts the UIColor to a Xamarin Color object.
/// </summary>
/// <param name="color">The color.</param>
/// <param name="defaultColor">The default color.</param>
/// <returns>UIColor.</returns>
public static UIColor ToUIColorOrDefault(this Xamarin.Forms.Color color, UIColor defaultColor)
{
if (color == Xamarin.Forms.Color.Default)
return defaultColor;
return color.ToUIColor();
}
示例12: TabControl
public TabControl(CGRect frame, UIColor selectedTabColor, UIColor unselectedTabColor)
{
this.unselectedTabColor = unselectedTabColor;
this.selectedTabColor = selectedTabColor;
this.items = new List<TabControlItem>();
this.Frame = frame;
}
示例13: CalloutAnnotation
public CalloutAnnotation(int count, CGRect rect, nfloat lineWidth, UIColor color)
{
Path = UIBezierPath.FromOval(rect);
Path.LineWidth = lineWidth;
var center = new CGPoint (rect.GetMidX(), rect.GetMidY());
Center = center;
nfloat startAngle = (nfloat)(Math.PI * 0.75);
nfloat endAngle = (nfloat)(Math.PI * 0.60);
Clip = UIBezierPath.FromArc(center, center.X + lineWidth, startAngle, endAngle, true);
Clip.AddLineTo(center);
Clip.ClosePath();
Clip.LineWidth = lineWidth;
Tail = new UIBezierPath ();
Tail.MoveTo(new CGPoint (center.X - 11, center.Y + 9));
Tail.AddLineTo(new CGPoint (center.X - 11, center.Y + 18));
Tail.AddLineTo(new CGPoint (center.X - 3, center.Y + 13));
Tail.LineWidth = lineWidth;
Rect = rect;
Color = color;
Count = count;
}
示例14: ToUIColor
public static UIColor ToUIColor(this Color color, UIColor defaultColor)
{
if (color.IsDefault)
return defaultColor;
return color.ToUIColor();
}
示例15: CreateAttributedStringFromBlocks
private static Tuple<NSMutableAttributedString,List<NewsCellView.Link>> CreateAttributedStringFromBlocks(UIFont font, UIColor primaryColor, IEnumerable<TextBlock> blocks)
{
var attributedString = new NSMutableAttributedString();
var links = new List<NewsCellView.Link>();
nint lengthCounter = 0;
int i = 0;
foreach (var b in blocks)
{
UIColor color = null;
if (b.Tapped != null)
color = LinkColor;
color = color ?? primaryColor;
var ctFont = new CoreText.CTFont(font.Name, font.PointSize);
var str = new NSAttributedString(b.Value, new CoreText.CTStringAttributes() { ForegroundColor = color.CGColor, Font = ctFont });
attributedString.Append(str);
var strLength = str.Length;
if (b.Tapped != null)
{
var weakTapped = new WeakReference<Action>(b.Tapped);
links.Add(new NewsCellView.Link { Range = new NSRange(lengthCounter, strLength), Callback = () => weakTapped.Get()?.Invoke(), Id = i++ });
}
lengthCounter += strLength;
}
return new Tuple<NSMutableAttributedString, List<NewsCellView.Link>>(attributedString, links);
}