private void prepareViews() { NavigationController.NavigationBarHidden = true; LoginButton.SetTitleColor( UIColor.White.ColorWithAlpha((nfloat)0.5), UIControlState.Disabled ); EmailTextField.ShouldReturn += _ => { PasswordTextField.BecomeFirstResponder(); return(false); }; PasswordTextField.ShouldReturn += _ => { ViewModel.Login(); PasswordTextField.ResignFirstResponder(); return(false); }; setupKeyboardDismissingGestureRecognizers(); prepareForgotPasswordButton(); ShowPasswordButton.SetupShowPasswordButton(); }
private void prepareViews() { NavigationController.NavigationBarHidden = true; LoginButton.SetTitleColor( Foundation.MvvmCross.Helper.Color.Login.DisabledButtonColor.ToNativeColor(), UIControlState.Disabled ); EmailTextField.ShouldReturn += _ => { PasswordTextField.BecomeFirstResponder(); return(false); }; PasswordTextField.ShouldReturn += _ => { ViewModel.Login(); PasswordTextField.ResignFirstResponder(); return(false); }; View.AddGestureRecognizer(new UITapGestureRecognizer(() => { EmailTextField.ResignFirstResponder(); PasswordTextField.ResignFirstResponder(); })); prepareForgotPasswordButton(); ShowPasswordButton.SetupShowPasswordButton(); }
private void prepareViews() { NavigationController.NavigationBarHidden = true; ActivityIndicator.Alpha = 0; ActivityIndicator.StartSpinning(); SignupButton.SetTitleColor( Core.UI.Helper.Colors.Login.DisabledButtonColor.ToNativeColor(), UIControlState.Disabled ); EmailTextField.ShouldReturn += _ => { PasswordTextField.BecomeFirstResponder(); return(false); }; PasswordTextField.ShouldReturn += _ => { ViewModel.Signup.Execute(); PasswordTextField.ResignFirstResponder(); return(false); }; View.AddGestureRecognizer(new UITapGestureRecognizer(() => { EmailTextField.ResignFirstResponder(); PasswordTextField.ResignFirstResponder(); })); ShowPasswordButton.SetupShowPasswordButton(); }
/* View LifeCycle Methods */ public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. var set = this.CreateBindingSet <LoginViewController, LoginViewModel>(); set.Bind(LoginButton).To(vm => vm.LoginCommand); set.Bind(UsernameTextField).To(vm => vm.Username); set.Bind(PasswordTextField).To(vm => vm.Password); set.Apply(); UsernameTextField.ShouldReturn += (textField) => { textField.ResignFirstResponder(); PasswordTextField.BecomeFirstResponder(); return(true); }; // Done button pressed PasswordTextField.ShouldReturn += (textField) => { textField.ResignFirstResponder(); return(true); }; }
private void prepareViews() { ActivityIndicator.Alpha = 0; ActivityIndicator.StartAnimation(); SignupButton.SetTitleColor( Color.Login.DisabledButtonColor.ToNativeColor(), UIControlState.Disabled ); EmailTextField.ShouldReturn += _ => { PasswordTextField.BecomeFirstResponder(); return(false); }; PasswordTextField.ShouldReturn += _ => { PasswordTextField.ResignFirstResponder(); return(false); }; PasswordTextField.ResignFirstResponder(); ShowPasswordButton.SetupShowPasswordButton(); SelectCountryButton.SemanticContentAttribute = UISemanticContentAttribute.ForceRightToLeft; var spacing = 4; SelectCountryButton.ImageEdgeInsets = new UIEdgeInsets(0, spacing, 0, 0); SelectCountryButton.TitleEdgeInsets = new UIEdgeInsets(0, 0, 0, spacing); }
private void prepareViews() { ActivityIndicator.Alpha = 0; ActivityIndicator.StartAnimation(); LoginButton.SetTitleColor( Color.Login.DisabledButtonColor.ToNativeColor(), UIControlState.Disabled ); EmailTextField.ShouldReturn += _ => { PasswordTextField.BecomeFirstResponder(); return(false); }; PasswordTextField.ShouldReturn += _ => { PasswordTextField.ResignFirstResponder(); return(false); }; PasswordTextField.ResignFirstResponder(); ShowPasswordButton.SetupShowPasswordButton(); prepareForgotPasswordButton(); }
protected override void SetupSubviews() { base.SetupSubviews(); BackgroundView = new UIImageView() { Image = AppImages.Background, UserInteractionEnabled = false }; SetNeedsDisplay(); InvalidCredentialLabel = new UILabel().SetCredentialLabel(Strings.InvalidCredential); LoginTextField = new UITextField().SetTextFieldStyle(Strings.Login); LoginTextField.ReturnKeyType = UIReturnKeyType.Next; LoginTextField.ShouldReturn = field => PasswordTextField.BecomeFirstResponder(); PasswordTextField = new UITextField().SetTextFieldStyle(Strings.Password); PasswordTextField.SecureTextEntry = true; PasswordTextField.ReturnKeyType = UIReturnKeyType.Done; PasswordTextField.ShouldReturn = field => PasswordTextField.ResignFirstResponder(); LoginButton = new UIButton().SetPrimaryButtonStyle(Strings.SignIn); ActivityIndicatorView = new ActivityIndicatorView(80, 1); }
private bool TextFieldShouldReturn(UITextField textField) { if (textField.Tag == 0) { PasswordTextField.BecomeFirstResponder(); } else { PasswordTextField.ResignFirstResponder(); } return(true); }
async partial void Authenticate(UIButton _) { var email = EmailTextField.Text; var passw = PasswordTextField.Text; if (string.IsNullOrWhiteSpace(email)) { ErrorMessageDialog(StringResources.common_ui_forms_email_validate_empty); } else if (string.IsNullOrWhiteSpace(passw)) { ErrorMessageDialog(StringResources.common_ui_forms_password_validate_empty); } else if (!Regex.Match(email, @"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$").Success) { ErrorMessageDialog(StringResources.common_ui_forms_email_validate_invalid); } else { PasswordTextField.BecomeFirstResponder(); PasswordTextField.ResignFirstResponder(); LoginUIButton.Enabled = false; var client = new RestClient(); LoginActivityIndicator.StartAnimating(); Logger.LOG_EVENT_WITH_ACTION("LOGIN", "ATTEMPT"); var response = await client.Login(email, passw); LoginActivityIndicator.StopAnimating(); LoginUIButton.Enabled = true; if (response.Meta.Messages.Count > 0) { Logger.LOG_EVENT_WITH_ACTION("LOGIN", "ERROR"); // Only show the first error as there var err = StringResources.ResourceManager.GetString($"login.api.error.{response.Meta.Messages[0]}"); ErrorMessageDialog(err); } else if (!string.IsNullOrEmpty(response.Data?.Tokens.Access)) { Logger.LOG_EVENT_WITH_ACTION("LOGIN", "SUCCESS"); NSUserDefaults.StandardUserDefaults.SetString(JsonConvert.SerializeObject(response.Data.Tokens), "tokens"); NSUserDefaults.StandardUserDefaults.SetString(email, "username"); Queries.SetActiveUser(response.Data); Analytics.SetUserID(response.Data.User.Id.ToString()); UIApplication.SharedApplication.Windows[0].RootViewController = UIStoryboard.FromName("Main", null).InstantiateInitialViewController(); } } }
private void prepareViews() { NavigationController.NavigationBarHidden = true; ActivityIndicator.Alpha = 0; ActivityIndicator.StartSpinning(); SignupButton.SetTitleColor( Color.Login.DisabledButtonColor.ToNativeColor(), UIControlState.Disabled ); EmailTextField.ShouldReturn += _ => { PasswordTextField.BecomeFirstResponder(); return(false); }; PasswordTextField.ShouldReturn += _ => { ViewModel.SignupCommand.Execute(); PasswordTextField.ResignFirstResponder(); return(false); }; View.AddGestureRecognizer(new UITapGestureRecognizer(() => { EmailTextField.ResignFirstResponder(); PasswordTextField.ResignFirstResponder(); })); SignupShakeTriggerButton.TouchUpInside += (sender, e) => { if (!ViewModel.Email.IsValid) { EmailTextField.Shake(); } if (!ViewModel.Password.IsValid) { PasswordTextField.Shake(); } if (!ViewModel.IsCountryValid) { SelectCountryButton.Shake(); CountryNotSelectedImageView.Shake(); CountryDropDownCaretImageView.Shake(); } }; ShowPasswordButton.SetupShowPasswordButton(); EmailTextField.ResignFirstResponder(); PasswordTextField.ResignFirstResponder(); }
bool UsernameTextField_ShouldReturn(UITextField textField) { if (PasswordTextField.Text == string.Empty) { return(PasswordTextField.BecomeFirstResponder()); } else if (UsernameTextField.Text == string.Empty) { return(UsernameTextField.BecomeFirstResponder()); } else { logIn(); View.EndEditing(true); } return(true); }
private void prepareViews() { NavigationController.NavigationBarHidden = true; LoginButton.SetTitleColor( Color.Login.DisabledButtonColor.ToNativeColor(), UIControlState.Disabled ); EmailTextField.ShouldReturn += _ => { PasswordTextField.BecomeFirstResponder(); return(false); }; PasswordTextField.ShouldReturn += _ => { ViewModel.LoginCommand.Execute(); PasswordTextField.ResignFirstResponder(); return(false); }; View.AddGestureRecognizer(new UITapGestureRecognizer(() => { EmailTextField.ResignFirstResponder(); PasswordTextField.ResignFirstResponder(); })); LoginShakeTriggerButton.TouchUpInside += (sender, e) => { if (!ViewModel.Email.IsValid) { EmailTextField.Shake(); } if (!ViewModel.Password.IsValid) { PasswordTextField.Shake(); } }; PasswordTextField.ResignFirstResponder(); ShowPasswordButton.SetupShowPasswordButton(); prepareForgotPasswordButton(); }
public override void ViewDidLoad() { base.ViewDidLoad(); Title = Resources.LoginTitle; prepareViews(); var invertedBoolConverter = new BoolToConstantValueConverter <bool>(false, true); var bindingSet = this.CreateBindingSet <TokenResetViewController, TokenResetViewModel>(); //Text bindingSet.Bind(ErrorLabel).To(vm => vm.Error); bindingSet.Bind(PasswordTextField) .For(v => v.BindSecureTextEntry()) .To(vm => vm.IsPasswordMasked); bindingSet.Bind(EmailLabel) .To(vm => vm.Email) .WithConversion(new EmailToStringValueConverter()); bindingSet.Bind(PasswordTextField) .To(vm => vm.Password) .WithConversion(new PasswordToStringValueConverter()); //Commands bindingSet.Bind(SignOutButton).To(vm => vm.SignOutCommand); bindingSet.Bind(nextButton) .For(v => v.BindCommand()) .To(vm => vm.DoneCommand); bindingSet.Bind(ShowPasswordButton) .For(v => v.BindTap()) .To(vm => vm.TogglePasswordVisibilityCommand); //Enabled bindingSet.Bind(PasswordTextField) .For(v => v.BindShouldReturn()) .To(vm => vm.DoneCommand); bindingSet.Bind(nextButton) .For(v => v.Enabled) .To(vm => vm.NextIsEnabled); //Visibility bindingSet.Bind(ErrorView) .For(v => v.BindVisible()) .To(vm => vm.HasError); bindingSet.Bind(ShowPasswordButton) .For(v => v.BindVisibility()) .To(vm => vm.IsLoading) .WithConversion(new MvxInvertedVisibilityValueConverter()); bindingSet.Bind(ActivityIndicatorView) .For(v => v.BindVisible()) .To(vm => vm.IsLoading); //State bindingSet.Apply(); PasswordTextField.BecomeFirstResponder(); }
public override void ViewDidLoad() { base.ViewDidLoad(); Title = Resources.LoginTitle; ResetSuccessLabel.Text = Resources.APITokenResetSuccess; InstructionLabel.Text = Resources.TokenResetInstruction; PasswordTextField.Placeholder = Resources.Password; SignOutButton.SetTitle(Resources.OrSignOut, UIControlState.Normal); prepareViews(); ViewModel.Error .Subscribe(ErrorLabel.Rx().Text()) .DisposedBy(DisposeBag); ViewModel.Email .SelectToString() .Subscribe(EmailLabel.Rx().Text()) .DisposedBy(DisposeBag); ViewModel.Password .Subscribe(PasswordTextField.Rx().TextObserver()) .DisposedBy(DisposeBag); PasswordTextField.Rx().Text() .Subscribe(ViewModel.Password) .DisposedBy(DisposeBag); ViewModel.IsPasswordMasked .Subscribe(PasswordTextField.Rx().SecureTextEntry()) .DisposedBy(DisposeBag); SignOutButton.Rx() .BindAction(ViewModel.SignOut) .DisposedBy(DisposeBag); ShowPasswordButton.Rx() .BindAction(ViewModel.TogglePasswordVisibility) .DisposedBy(DisposeBag); nextButton.Rx().Tap() .Subscribe(ViewModel.Done.Inputs) .DisposedBy(DisposeBag); PasswordTextField.Rx().ShouldReturn() .Subscribe(ViewModel.Done.Inputs) .DisposedBy(DisposeBag); //Enabled ViewModel.NextIsEnabled .Subscribe(nextButton.Rx().Enabled()) .DisposedBy(DisposeBag); //Visibility ViewModel.HasError .Subscribe(ErrorView.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.Done.Executing .Invert() .Subscribe(ShowPasswordButton.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.Done.Executing .Subscribe(ActivityIndicatorView.Rx().IsVisible()) .DisposedBy(DisposeBag); PasswordTextField.BecomeFirstResponder(); }
public override void ViewDidLoad() { base.ViewDidLoad(); Title = Resources.LoginTitle; ResetSuccessLabel.Text = Resources.APITokenResetSuccess; InstructionLabel.Text = Resources.TokenResetInstruction; PasswordTextField.Placeholder = Resources.Password; SignOutButton.SetTitle(Resources.OrSignOut, UIControlState.Normal); EmailLabel.Text = ViewModel.Email.ToString(); ViewModel.Error .Subscribe(ErrorLabel.Rx().Text()) .DisposedBy(DisposeBag); ViewModel.Password .Subscribe(PasswordTextField.Rx().TextObserver()) .DisposedBy(DisposeBag); PasswordTextField.Rx().Text() .Subscribe(ViewModel.Password) .DisposedBy(DisposeBag); SignOutButton.Rx() .BindAction(ViewModel.SignOut) .DisposedBy(DisposeBag); ViewModel.SignOut.Elements .Subscribe(IosDependencyContainer.Instance.IntentDonationService.ClearAll) .DisposedBy(DisposeBag); ShowPasswordButton.Rx().Tap() .Subscribe(_ => { PasswordTextField.ResignFirstResponder(); PasswordTextField.SecureTextEntry = !PasswordTextField.SecureTextEntry; PasswordTextField.BecomeFirstResponder(); }) .DisposedBy(DisposeBag); LoginButton.Rx().Tap() .Subscribe(ViewModel.Done.Inputs) .DisposedBy(DisposeBag); PasswordTextField.Rx().ShouldReturn() .Subscribe(ViewModel.Done.Inputs) .DisposedBy(DisposeBag); //Enabled ViewModel.NextIsEnabled .Subscribe(LoginButton.Rx().Enabled()) .DisposedBy(DisposeBag); //Visibility ErrorLabel.Hidden = true; ViewModel.HasError .Subscribe(ErrorLabel.Rx().AnimatedIsVisible()) .DisposedBy(DisposeBag); ViewModel.Done.Executing .Invert() .Subscribe(ShowPasswordButton.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.Done.Executing .Subscribe(ActivityIndicatorView.Rx().IsVisibleWithFade()) .DisposedBy(DisposeBag); ViewModel.Done.Executing.Select(loginButtonTitle) .Subscribe(LoginButton.Rx().AnimatedTitle()) .DisposedBy(DisposeBag); PasswordTextField.BecomeFirstResponder(); ShowPasswordButton.SetupShowPasswordButton(); //Color ViewModel.HasError .Select(loginButtonTintColor) .Subscribe(LoginButton.Rx().TintColor()) .DisposedBy(DisposeBag); ViewModel.NextIsEnabled .Select(loginButtonTitleColor) .Subscribe(LoginButton.Rx().TitleColor()) .DisposedBy(DisposeBag); UIColor loginButtonTintColor(bool hasError) => hasError ? UIColor.White : UIColor.Black; UIColor loginButtonTitleColor(bool enabled) => enabled ? Core.UI.Helper.Colors.Login.EnabledButtonColor.ToNativeColor() : Core.UI.Helper.Colors.Login.DisabledButtonColor.ToNativeColor(); }
private void SetDataAndStyleToView() { // init strings in view InitializeAllStrings(); // set up the background //BackgroundImageView2.Image = UIImage.FromBundle("LoginBackground"); // dissmiss the keyboard when i press return key on email TextField EmailTextField.ShouldReturn += (textField) => { EmailTextField.ResignFirstResponder(); PasswordTextField.BecomeFirstResponder(); return(true); }; // dissmiss the keyboard when i press return key on password TextField PasswordTextField.ShouldReturn += (textField) => { PasswordTextField.ResignFirstResponder(); LoginButton_TouchUpInside(null, null); return(true); }; // dissmiss the keyboard when i press return key on Name TextField FirstNameTextField.ShouldReturn += (textField) => { FirstNameTextField.ResignFirstResponder(); LastNameTextField.BecomeFirstResponder(); return(true); }; // dissmiss the keyboard when i press return key on FirstName TextField LastNameTextField.ShouldReturn += (textField) => { LastNameTextField.ResignFirstResponder(); EmailTextFieldOfRegistration.BecomeFirstResponder(); return(true); }; // dissmiss the keyboard when i press return key on email TextField EmailTextFieldOfRegistration.ShouldReturn += (textField) => { EmailTextFieldOfRegistration.ResignFirstResponder(); PasswordTextFieldOfRegistration.BecomeFirstResponder(); return(true); }; // dissmiss the keyboard when i press return key on password TextField PasswordTextFieldOfRegistration.ShouldReturn += (textField) => { PasswordTextFieldOfRegistration.ResignFirstResponder(); ConfirmPasswordTextField.BecomeFirstResponder(); return(true); }; PasswordTextFieldOfRegistration.EditingChanged += (o, e) => { ErrorMessageLabel.Hidden = true; }; PasswordTextFieldOfRegistration.ShouldBeginEditing += (textField) => { if (View.Frame.Y >= 0) { bottom = ((float)(RegistrationContainer.Frame.Y + PasswordTextFieldOfRegistration.Frame.Y + PasswordTextFieldOfRegistration.Frame.Height + 10)); } return(true); }; // dissmiss the keyboard when i press return key on Confirm Password TextField ConfirmPasswordTextField.ShouldReturn += (textField) => { ConfirmPasswordTextField.ResignFirstResponder(); return(true); }; ConfirmPasswordTextField.EditingChanged += (o, e) => { ErrorMessageLabel.Hidden = true; }; ConfirmPasswordTextField.ShouldBeginEditing += (textField) => { if (View.Frame.Y >= 0) { bottom = ((float)(RegistrationContainer.Frame.Y + ConfirmPasswordTextField.Frame.Y + ConfirmPasswordTextField.Frame.Height + 10)); } return(true); }; // dissmiss the keyboard when i press return key on Confirm Password TextField EmailTextFieldOfForgetPassword.ShouldReturn += (textField) => { EmailTextFieldOfForgetPassword.ResignFirstResponder(); return(true); }; EmailTextField.KeyboardType = UIKeyboardType.EmailAddress; EmailTextField.AutocorrectionType = UITextAutocorrectionType.No; PasswordTextField.AutocorrectionType = UITextAutocorrectionType.No; FirstNameTextField.ReturnKeyType = UIReturnKeyType.Next; LastNameTextField.AutocorrectionType = UITextAutocorrectionType.No; LastNameTextField.ReturnKeyType = UIReturnKeyType.Next; EmailTextFieldOfRegistration.KeyboardType = UIKeyboardType.EmailAddress; EmailTextFieldOfRegistration.AutocorrectionType = UITextAutocorrectionType.No; EmailTextFieldOfRegistration.ReturnKeyType = UIReturnKeyType.Next; PasswordTextFieldOfRegistration.ReturnKeyType = UIReturnKeyType.Next; ConfirmPasswordTextField.ReturnKeyType = UIReturnKeyType.Next; EmailTextFieldOfForgetPassword.KeyboardType = UIKeyboardType.EmailAddress; EmailTextFieldOfForgetPassword.AutocorrectionType = UITextAutocorrectionType.No; // set up the rounded corner fot the button LoadingIndicator.Hidden = true; LoginButton.Layer.CornerRadius = 4; LoginButton.Layer.MasksToBounds = true; RegistrationButton.Layer.CornerRadius = 4; RegistrationButton.Layer.MasksToBounds = true; RegistrationButton.Enabled = false; ResetPasswordButton.Layer.CornerRadius = 4; ResetPasswordButton.Layer.MasksToBounds = true; ResetPasswordButton.Enabled = false; //DisplayFacebookButton(); //_facebookButton.Layer.CornerRadius = 4; //_facebookButton.Layer.MasksToBounds = true; CreateAccountButton.ContentEdgeInsets = new UIEdgeInsets(5, 0, 5, 5); ForgetPasswordButton.ContentEdgeInsets = new UIEdgeInsets(5, 5, 5, 0); LoginContainer.Hidden = false; RegistrationContainer.Hidden = true; ForgetPasswordContainer.Hidden = true; BackButton.Hidden = true; CreateAccountButton.Hidden = false; ForgetPasswordButton.Hidden = false; ErrorMessageLabel.Hidden = true; ErrorMessageLabel.TextColor = UIColor.FromRGB(255, 76, 56); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. var set = this.CreateBindingSet <BaseUserViewController, BaseUserViewModel>(); //set.Bind(TakeButton).To(vm => vm.TakePictureCommand); //set.Bind(PhotoImageTapGestureRecognizer).To(vm => vm.ChoosePictureCommand); //set.Bind(LoginButton).To(vm => vm.LoginCommand); set.Bind <UITextField>(CompanyNameTextField).To(vm => vm.CompanyName); set.Bind <UITextField>(FullNameTextField).To(vm => vm.FullName); set.Bind <UITextField>(UsernameTextField).To(vm => vm.Username); set.Bind <UITextField>(PasswordTextField).To(vm => vm.Password); set.Bind <UITextField>(ConfirmPasswordTextField).To(vm => vm.ConfirmPassword); // set.Bind(AddButtonItem).To(vm => vm.AddUserCommand); set.Bind <UIImageView>(PhotoImageView).To(vm => vm.PhotoDataBytes).WithConversion("InMemoryImage"); set.Apply(); PropertiesTapGestureRecognizer.AddTarget(() => { var controller = this.CreateViewControllerFor <PropertyPickerViewModel>(new { viewOnlyMode = !Editing, jsonSelectedPropertyList = JsonConvert.SerializeObject(ViewModel.Properties), requestedViewId = ViewModel.ViewInstanceId, userId = ViewModel.UserId }) as PropertyPickerViewController; NavigationController.PushViewController(controller, true); }); PhotoImageTapGestureRecognizer.AddTarget(() => { if (Editing) { if (Runtime.Arch == Arch.DEVICE) { ViewModel.TakePictureCommand.Execute(null); } else if (Runtime.Arch == Arch.SIMULATOR) { ViewModel.ChoosePictureCommand.Execute(null); } } }); ViewModel.OnPictureEventHandler += (object sender, EventArgs e) => { PlaceholderImageView.Hidden = true; }; ViewModel.OnPictureCancelledEventHandler += (object sender, EventArgs e) => { }; // Dismiss view controller after user added //ViewModel.AddUserSuccessEventHandler += (object sender, EventArgs e) => NavigationController.PopViewControllerAnimated (true); // CancelButtonItem.Clicked += (object sender, EventArgs e) => NavigationController.PopViewControllerAnimated (true); FullNameTextField.ShouldReturn += (textField) => { textField.ResignFirstResponder(); UsernameTextField.BecomeFirstResponder(); return(true); }; UsernameTextField.ShouldReturn += (textField) => { textField.ResignFirstResponder(); PasswordTextField.BecomeFirstResponder(); return(true); }; PasswordTextField.ShouldReturn += (textField) => { textField.ResignFirstResponder(); ConfirmPasswordTextField.BecomeFirstResponder(); return(true); }; // Done button pressed ConfirmPasswordTextField.ShouldReturn += (textField) => { textField.ResignFirstResponder(); return(true); }; SetEditing(true, false); }