static UIRectCorner GetRectCorners(XPlatCornerRadius cornerRadius) { long cornersFlags = 0; if (cornerRadius.BottomLeft) { cornersFlags |= (long)UIRectCorner.BottomLeft; } if (cornerRadius.BottomRight) { cornersFlags |= (long)UIRectCorner.BottomRight; } if (cornerRadius.TopLeft) { cornersFlags |= (long)UIRectCorner.TopLeft; } if (cornerRadius.TopRight) { cornersFlags |= (long)UIRectCorner.TopRight; } if (cornersFlags <= 0 || cornerRadius.AllCorner) { cornersFlags = (long)UIRectCorner.AllCorners; } return((UIRectCorner)cornersFlags); }
public static void ApplyCornerRadius(this UIButton @this, XPlatCornerRadius cornerRadius) { if (@this == null || cornerRadius == null) { return; } @this.ApplyCornerRadius(GetRectCorners(cornerRadius), cornerRadius.Radius); }
public static void ApplyAllCornerRadius(this CALayer @this, XPlatCornerRadius cornerRadius) { if (@this == null || cornerRadius == null) { return; } //if (cornerRadius.AllCorner) @this.CornerRadius = cornerRadius.Radius; }
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); }