Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6844749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:24:58+00:00 2026-05-27T00:24:58+00:00

I have a view with two UITextField , one for username, one for password.

  • 0

I have a view with two UITextField, one for username, one for password.

I added functionality so the usernameTF return button jumps to the passwordTF. I also made the return button on the passwordTF “Go” which I want to connect to a IBAction I have which will contain the actual login logic.

I tried hooking up the IBAction to the passwordTF’s Did End On Exit method but that just seemed to be getting called when the usernameTF was making the passwordTF the first responder.

I’m using this code to jump from usernameTF to passwordTF:

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    if (textField == self.usernameTextField) {
        [self.passwordTextField becomeFirstResponder];
    }
    [textField resignFirstResponder];
    return YES;
}

I tried this but it does’t call the method when I press Go/Return:

[self.passwordTextField addTarget:self
                               action:@selector(loginButtonPressed:)
                     forControlEvents:UIControlEventEditingDidEndOnExit];

I also tried connecting the IBAction to the UITextField‘s Editing Did End method which calls the method fine when I press the return button, but it also calls the method when I click any UITextField other than the one I have connected with that method. Any fix?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:24:59+00:00Added an answer on May 27, 2026 at 12:24 am

    You can try using this

    -(BOOL)textFieldShouldReturn:(UITextField *)textField{
        [textField resignFirstResponder];
        if (textField == txtfEmail)
            [txtfPassword becomeFirstResponder];
        else {
            [self login];
        }
        return YES;
    }
    

    Where [self login] is actually the login method being called. Validating login credential from Server or from Database. txtfEmail is Login Name and txtfPassword being the password field. Hope it helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently developing an iPhone app where I have two UITextField's in one View
I have a UIViewController, and I've added two subviews to its view. One subview
I have two UITextField one for Portrait and other for Lanscape View but I
I have one strange problem.I have two UItextfields in my view and a button.When
I have two view controllers. In one of them I have a UITextField within
So I have two view controllers in my iphone project - one of them
I have created a UITableView with two cells, username and password using the code
I have a view with two subviews a button and an Image, I turn
I have two view controllers. I'm on first, and when I press the button,
I have a view ( parent ) with two subviews, one on top (

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.