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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:52:33+00:00 2026-06-17T18:52:33+00:00

I have spent about 2 days on this issue going through several stack overflow/online

  • 0

I have spent about 2 days on this issue going through several stack overflow/online posts and can’t seem to find an answer.

I have 6 UITextFields. The bottom two hide when the keyboard appears. However, when I start typing:

On a 4″ screen (iPhone 5): The textfields scroll up and hide behind the navigation bar.

On a 3.5″ screen (iPhone 3GS): The textfields scroll up right below the navigation bar, which is where it should be.

When the user clicks on the UITextFields, I want the UITextFields to scroll up and end up right before navigation bar, RIGHT AWAY. This way the field appears and ready for input and is not hidden waiting for the user to begin typing before scrolling up.

I’m not sure if this is relevant, but I have UIControllerView and inside, it has a containerView. The containerView does not cover the entire screen and starts at X:68 Y:7 Width: 237 Height: 351. Inside the ContainerView I have the UIScrollView with UITextFields. The containerView also has its own NavigationBar. On the iPhone 5 (4″ Screen), when scrolled up, the TextFields are hiding behind the NavigationBar inside the containerView. On the iPhone 3GS (3.5″ screen), UITextfield appear right below the NavigationBar, as they should.

Here is the code which I followed from Apple Docs:

.h 
@interface ContactViewController : UIViewController <UITextFieldDelegate>
{
    UITextField *activeField;
}

.m
- (void) viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasShown:)
                                             name:UIKeyboardWillShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillBeHidden:)
                                             name:UIKeyboardWillHideNotification object:nil];
}

// Called when the UIKeyboardDidShowNotification is sent.
- (void)keyboardWasShown:(NSNotification*)aNotification
{
    NSDictionary* info = [aNotification userInfo];
    CGSize kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;

    UIEdgeInsets contentInsets = UIEdgeInsetsMake(0, 0, kbSize.height, 0.0);
    pageScrollView.contentInset = contentInsets;
    pageScrollView.scrollIndicatorInsets = contentInsets;

    // If active text field is hidden by keyboard, scroll it so it's visible
    // Your application might not need or want this behavior.
    CGRect aRect = self.view.frame;
    aRect.size.height -= kbSize.height;
    if (!CGRectContainsPoint(aRect, activeField.frame.origin) ) {
    CGPoint scrollPoint = CGPointMake(0.0, activeField.frame.origin.y-kbSize.height);
    [pageScrollView setContentOffset:scrollPoint animated:YES];
    }
}


// Called when the UIKeyboardWillHideNotification is sent
- (void)keyboardWillBeHidden:(NSNotification*)aNotification
{
    UIEdgeInsets contentInsets = UIEdgeInsetsZero;
    pageScrollView.contentInset = contentInsets;
    pageScrollView.scrollIndicatorInsets = contentInsets;
}

I got the code from Apple Doc’s: http://developer.apple.com/library/ios/#documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement

  • 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-06-17T18:52:35+00:00Added an answer on June 17, 2026 at 6:52 pm

    After days of struggling with this and contemplating with which route to take, I decided to turn my UIViewController into a UITableViewController that provides scroll functionailty built in. I made this decision primarily because in the future I’d like Localize my app in a few other langages and instaed of having to manually reinvent the wheel for each language, I thought it would be much easier to settle for a customized TableView.

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

Sidebar

Related Questions

I have spent several days now researching Hibernate and have several small questions about
I have now spent 2 days trying to get this going. I am however
I have spent about half a day searching for an answer to this question
I've spent two days on this and have gotten nowhere. I'm trying to use
I have spent about 2 Days trying to find out how to make 3d
Warning! This problem is not for the feint of heart. I've spent several days
I’ve got a pyparsing issue that I have spent days trying to fix, with
I spent days to search about this topic and I found some good articles,
I have spent 3 days reading and doing tutorials about PHP upload scripts for
Have spent an hour trying to solve this - but to no avail. I'm

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.