public override void ViewDidLoad() { base.ViewDidLoad(); var s = DrawXSettingsManager.Settings; ServerEntry.Text = s.ServerIP; UsernameEntry.Text = s.Username; PasswordEntry.Text = s.Password; LoginButton.TouchUpInside += (sender, e) => { DoLogin(); }; // you can only cancel logging in if already logged in, otherwise it is meaningless CancelButton.Enabled = (DrawXSettingsManager.LoggedInUser != null); CancelButton.TouchUpInside += (sender, e) => { OnCloseLogin(false); }; #region Return key behaviour on keyboard - Next unti last field then Go ServerEntry.ShouldReturn += (textField) => { UsernameEntry.BecomeFirstResponder(); return(false); // no linebreak insertion }; UsernameEntry.ShouldReturn += (textField) => { PasswordEntry.BecomeFirstResponder(); return(false); }; PasswordEntry.ShouldReturn += (textField) => { ((UITextField)textField).ResignFirstResponder(); DoLogin(); return(false); }; #endregion }