void InitObjects() { TextField = new TextFieldHandleText(); (TextField as UITextField).ChangeTextFieldStyle(UIFont.FromName("Helvetica", Theme.MediumTextSize), Theme.SmallTextSize, UIColor.Black, false, UITextAlignment.Left); TextField.ClearButtonMode = UITextFieldViewMode.WhileEditing; _errorMessageLabel = new UILabel().ChangeLabelStyle(UIFont.FromName("Helvetica", Theme.SmallestTextSize), Theme.SmallestTextSize, ErrorColor, false, UITextAlignment.Left); _errorMessageLabel.Lines = 0; TextField.ResignFirstResponder(); this.AddIfNotNull(_errorMessageLabel); this.AddIfNotNull(_textField); this.AddConstraints( _textField.AtTopOf(this), _textField.AtLeftOf(this, 4), _textField.AtRightOf(this, 4), _errorMessageLabel.Below(_textField, 4), _errorMessageLabel.AtLeftOf(this), _errorMessageLabel.AtRightOf(this), _errorMessageLabel.Height().EqualTo(15), _errorMessageLabel.AtBottomOf(this) ); }
void InitObjects() { _topLabel = new UILabel().ChangeLabelStyle(UIFont.FromName("Helvetica", Theme.SmallTextSize), Theme.SmallestTextSize, topLabelColor, false, UITextAlignment.Left); TextField = new TextFieldHandleText(); (TextField as UITextField).ChangeTextFieldStyle(UIFont.FromName("Helvetica", Theme.MediumTextSize), Theme.SmallTextSize, UIColor.Black, false, UITextAlignment.Left); TextField.ClearButtonMode = UITextFieldViewMode.WhileEditing; TextField.InitTextBindHandle = (() => _topLabel.Text = string.IsNullOrEmpty(TextField?.Text) ? string.Empty : TextField?.Placeholder ); _topLabel.Text = TextField.Placeholder; _errorMessageLabel = new UILabel().ChangeLabelStyle(UIFont.FromName("Helvetica", Theme.SmallestTextSize), Theme.SmallestTextSize, ErrorColor, false, UITextAlignment.Left); _errorMessageLabel.Lines = 0; _separatorView = new UIView() { BackgroundColor = Theme.BlueGray50.ToUIColor() }; TextField.ResignFirstResponder(); TextField.AddTarget(HandleTextField, UIControlEvent.EditingChanged); this.AddIfNotNull(_topLabel); this.AddIfNotNull(_separatorView); this.AddIfNotNull(_errorMessageLabel); this.AddIfNotNull(_textField); this.AddConstraints( _topLabel.AtTopOf(this), _topLabel.AtLeftOf(this), _topLabel.AtRightOf(this), _topLabel.WithRelativeHeight(this, 0.3f), _textField.Below(_topLabel, 2), _textField.AtLeftOf(this), _textField.AtRightOf(this), _textField.WithRelativeHeight(this, 0.5f), _separatorView.Below(_textField, 2), _separatorView.WithSameWidth(_textField), _separatorView.WithSameLeft(_textField), _separatorView.WithSameRight(_textField), _separatorView.Height().EqualTo(1), _errorMessageLabel.Below(_separatorView, 4), _errorMessageLabel.AtLeftOf(this), _errorMessageLabel.AtRightOf(this), _errorMessageLabel.AtBottomOf(this) ); }