Пример #1
0
 public static CGColor ToCGColor(this XPlatColor color)
 {
     if (color == null)
     {
         return(new CGColor(0, 0, 0, 0));
     }
     return(new CGColor(color.Red, color.Green, color.Blue, (int)(color.Alpha * 255)));
 }
Пример #2
0
 public static UIColor ToNative(this XPlatColor color)
 {
     if (color == null)
     {
         return(UIColor.Clear);
     }
     return(UIColor.FromRGBA(color.Red, color.Green, color.Blue, (int)(color.Alpha * 255)));
 }
Пример #3
0
 public static void ApplyBackgroundColor(this UIButton @this, XPlatColor color)
 {
     if (@this == null || color == null)
     {
         return;
     }
     @this.BackgroundColor = color.ToNative();
 }
Пример #4
0
 public static void ApplyTextColor(this UIButton @this, XPlatColor color)
 {
     if (@this == null || color == null)
     {
         return;
     }
     @this.SetTitleColor(color.ToNative(), UIControlState.Normal);
 }
Пример #5
0
 public static void ApplyTextColor(this UILabel @this, XPlatColor color)
 {
     if (@this == null || color == null)
     {
         return;
     }
     @this.TextColor = color.ToNative();
 }
Пример #6
0
        public static void ApplyBorderColor(this UIView @this, XPlatColor color, int size = 1, XPlatCornerRadius cornerRadius = null)
        {
            if (@this == null || color == null)
            {
                return;
            }

            if (cornerRadius == null)
            {
                cornerRadius = new XPlatCornerRadius(5);
            }

            @this.ApplyBorder(GetRectCorners(cornerRadius), cornerRadius?.Radius ?? 0, color.ToNative(), (float)size);
        }