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

  • SEARCH
  • Home
  • 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 7821729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:44:02+00:00 2026-06-02T07:44:02+00:00

I am doing a project on gpsnote. if anyone have any information abt this

  • 0

I am doing a project on gpsnote. if anyone have any information abt this application plz guide me…

I know this code bt i want textfield should come along with my keyboard

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder];
}

thanks

  • 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-02T07:44:03+00:00Added an answer on June 2, 2026 at 7:44 am

    First set your content over a scroll view and set the scroll view in viewDidLoad:

    [scrollView setContentSize : CGSizeMake (320, 1040)];
    

    then in viewWillAppear add following notification :

    For keyboard shown

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(keyboardWasShown:)
                                                 name:UIKeyboardDidShowNotification object:nil];
    

    For keyboard hiding

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

    Following are the two function which are called by the notifications

    - (void)keyboardWasShown:(NSNotification*)aNotification {
    
    NSDictionary* info = [aNotification userInfo];
    CGSize kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
    
    double keyboardHeight = kbSize.height;
    double screenHeight =   [UIScreen mainScreen].bounds.size.height - 20;
    
    if(textOrigin > screenHeight - keyboardHeight)
    {
        double sofset =  textOrigin - (screenHeight - keyboardHeight);
        CGPoint offset = scrollBackGround.contentOffset;
        offset.y += sofset;
        [scrollBackGround setContentOffset:offset animated:YES];
    }
    
    }
    
    
    - (void)keyboardWillBeHidden:(NSNotification*)aNotification
    {
        [scrollBackGround setContentOffset:CGPointMake(0, 0) animated:YES];
    }
    

    In keyboardWasShown function what we are doing is just getting the height of the keyboard and checking if the textField y axis (i.e textOrigin in the function) are greater than Y axis of keyboard than slide up the content of the scrollview which contain our text field.

    NOw How to get the textfield Y axis. For this you have to use the textfield delegate, the following delegate will trigger when your textfield will become first responder

    - (void)textFieldDidBeginEditing:(UITextField *)textField
    {
        textOrigin  =   scrollBackGround.frame.origin.y + textField.frame.origin.y + 20(it is status bar height) + yourNavigationBarheight;
    
    // Make sure to make textOrigin an ivar in your .h file
    }
    

    And finally in keyboardWillBeHidden we are reseting the scrollview contentview

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

Sidebar

Related Questions

I was doing a project in a Java book and came across this code
I am doing project euler question 33 and have divised a refactor to solve
I am doing project in cakephp . I want to write below query in
Im doing a project with C# winforms. This project is composed by: alt text
Im doing this project where i need to download files through a webservice (images,
I am doing a project where I want a person to enter the name
I m doing project in opencv... i m getting error like this Unhandled exception
while doing flex project iam unable to start my Jboss server. can any one
I am doing project euler question 224 . And whipped up this list comprehension
I am doing project in ASP.Net, and i have used QueryString for dynamic profiles

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.