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 7308035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T23:30:09+00:00 2026-05-28T23:30:09+00:00

I have created a bar over the keyboard for textfields with previous/next/done button selections.

  • 0

I have created a bar over the keyboard for textfields with previous/next/done button selections. In doing so, I noticed an odd occurance with my tags that I used to navigate between the textfields. I am creating my interface programmatically with a loop, and as such, just set the tag values to the loop variable i.

I started the i variable at 0 so the very first text field created had a tag of zero. Basically what was happening is the ‘previous’ button functionality would only go so low as 1. It wouldn’t even go back to the text field with the 0 tag. The only way to fix this was to increase all tag values by 1 so the first text field started at 1 instead of zero.

Here is my code. Is there a bug in my code that I cannot see? or is this a weird issue with tags?

    -(void)gotoPrevTextfield{
// If the active textfield is the first one, can't go to any previous
// field so just return.
 UITextField *textField =  (UITextField *)[inputsView viewWithTag:0];
NSLog(@"%i",textField.tag);
NSLog(@"%i",txtActiveField.tag);
if (txtActiveField == textField) {
    NSLog(@"returning at previous");
    return;
}
else {
    NSLog(@"set responder");
    // Otherwise if a different textfield has the focus, the operation
    // of "previous" button can be done and set the previous as the first
    // responder.
    textField = (UITextField *)[inputsView viewWithTag:txtActiveField.tag - 1];
    NSLog(@"%i",textField.tag);
    NSLog(@"%i",txtActiveField.tag);
    [textField becomeFirstResponder];
}

}
  • 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-28T23:30:09+00:00Added an answer on May 28, 2026 at 11:30 pm

    Note that unset tags default to 0 so that is almost a poor choice. You may be getting another view that you don’t expect.

    A fairly good practice is to add some constant such as 100, consider making the constant a const int or #define for clarity.

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

Sidebar

Related Questions

I have created a bar to appear over the keyboard for next/previous/done like the
friends, i have created custom title bar using following titlebar.xml file with code <?xml
I have created a flexible navigation bar in my app that will show custom
I have created a status item (menu bar item) for my app, but at
I have created an activity which sends a number of notifications to status bar.
I am new to iphone development.I have created a UIBarButtonItem on the navigation bar.I
I have a Tab Bar Controller created in Interface Builder Within the Tab Bar
I have to create a custom compound button bar control in Android like the
i have an ole Object created with (simple verion) obj := CreateOleObject('foo.bar'); obj.OnResult :=
so I have a tab bar application where i have put a button to

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.