public override void Draw(CoreGraphics.CGRect rect) { BackgroundColor = UIColor.Clear; Layer.CornerRadius = Frame.Size.Height / 2; Layer.BorderWidth = 1; Layer.BorderColor = ColorUtils.GetColor(Slink.ColorUtils.ColorType.LandingTextFieldNormal).CGColor; LeftViewMode = UITextFieldViewMode.Always; RightViewMode = UITextFieldViewMode.Always; LeftView = new UIView(new CGRect(0, 0, 10, 10)); TextColor = ColorUtils.GetColor(Slink.ColorUtils.ColorType.DefaultText); if (SecureTextEntry) { var showButton = new UIButton(new CGRect(20, 5, 35, rect.Height - 10)); showButton.SetImage(UIImage.FromBundle("Check"), UIControlState.Normal); showButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Left; showButton.ImageView.ContentMode = UIViewContentMode.ScaleAspectFit; showButton.TouchUpInside -= ShowButton_TouchUpInside; showButton.TouchUpInside += ShowButton_TouchUpInside; RightView = showButton; } else { RightView = new UIView(new CGRect(0, 0, 10, rect.Height)); } }
public void ShowHud(String message) { if (Hud == null) { Hud = new MTMBProgressHUD(View); } MTMBProgressHUD.Appearance.TintColor = UIColor.Red; Hud.RemoveFromSuperViewOnHide = true; Hud.Color = ColorUtils.GetColor(Slink.ColorUtils.ColorType.Theme); Hud.LabelText = message; Hud.LabelColor = UIColor.White; Hud.DimBackground = true; View.AddSubview(Hud); Hud.Show(true); }
protected void ToggleErrorView(bool visible, UIView target, NSLayoutConstraint constraint, nfloat constraintValue, LandingTextField field) { constraint.Constant = constraintValue; if (visible) { field.SetInvalid(); } else { field.Reset(); } UIView.Animate(0.25, () => { target.Alpha = (visible) ? 1 : 0; View.SetNeedsLayout(); }); if (ProgressButton != null) { ProgressButton.BackgroundColor = ValidateAllFields() ? ColorUtils.GetColor(Slink.ColorUtils.ColorType.LandingButton) : UIColor.Gray; } }
public void Reset() { Layer.BorderColor = ColorUtils.GetColor(Slink.ColorUtils.ColorType.LandingTextFieldNormal).CGColor; }
public void SetInvalid() { Layer.BorderColor = ColorUtils.GetColor(Slink.ColorUtils.ColorType.LandingTextFieldError).CGColor; }
public void SetProgressButton(UIButton progressButton) { ProgressButton = progressButton; ProgressButton.BackgroundColor = ColorUtils.GetColor(Slink.ColorUtils.ColorType.LandingButtonDisabled); ProgressButton.Layer.CornerRadius = ProgressButton.Frame.Size.Height / 2; }