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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:42:10+00:00 2026-05-13T07:42:10+00:00

Actually I have textfield in my sixth section of the tableview and a textview

  • 0

Actually I have textfield in my sixth section of the tableview and a textview in the eleventh section of the textview.My problem is when I click on to the texfield of the sixth section the keyboard covers the text field and the same thing was happening with the textview.for that I used NSNotificationCenters.
and I wrote the code as:

-(void)viewWillAppear:(BOOL)animated{

tableView.tableFooterView=nil;
[self reloadView];  
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) 
                                             name:UIKeyboardWillShowNotification object:self.view.window]; 

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) 
                                             name:UIKeyboardWillHideNotification object:self.view.window];
[tableView reloadData]; 

}

-(void)setViewMovedUp:(BOOL)movedUp{

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5]; // if you want to slide up the view
CGRect rect = mview.frame;
if (movedUp)
{
rect.origin.y = rect.origin.y – kOFFSET_FOR_KEYBOARD;
rect.size.height = rect.size.height + kOFFSET_FOR_KEYBOARD;
}
else
{
rect.origin.y = rect.origin.y + kOFFSET_FOR_KEYBOARD;
rect.size.height = rect.size.height – kOFFSET_FOR_KEYBOARD;
}
mview.frame = rect;

[UIView commitAnimations];

}

  • (void)keyboardWillShow:(NSNotification *)notif
    {
    // printf(“\n Keyboard Will SHOW”);
    //keyboard will be shown now. depending for which textfield is active, move up or move down the view appropriately

    if ([notesTextView isFirstResponder] && mview.frame.origin.y >= 0)
    {
    [self setViewMovedUp:YES];
    }
    else if (![notesTextView isFirstResponder] && mview.frame.origin.y < 0)
    {
    [self setViewMovedUp:NO];
    }

    else if ([wineryTextField isFirstResponder] && mview.frame.origin.y >= 0)
    {
    [self setViewMovedUp:YES];
    }
    else if (![wineryTextField isFirstResponder] && mview.frame.origin.y < 0)
    {
    [self setViewMovedUp:NO];
    }

}

  • (void)keyboardWillHide:(NSNotification *)notif
    {
    // printf(“\n Keyboard Will hide”);
    //keyboard will be shown now. depending for which textfield is active, move up or move down the view appropriately

    if ([notesTextView isFirstResponder] && mview.frame.origin.y >= 0)
    {
    [self setViewMovedUp:YES];
    }
    else if (![notesTextView isFirstResponder] && mview.frame.origin.y < 0)
    {
    [self setViewMovedUp:NO];
    }

    else if ([wineryTextField isFirstResponder] && mview.frame.origin.y >= 0)
    {
    [self setViewMovedUp:YES];
    }
    else if (![wineryTextField isFirstResponder] && mview.frame.origin.y < 0)
    {
    [self setViewMovedUp:NO];
    }

}

  • (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range
    replacementText:(NSString *)text
    {
    if ( [ text isEqualToString: @”\n” ] ) {

    //event.eventNotes = notesTextView.text;
    
     if(textView==notesTextView)
    {
    
        //[self setViewMovedUp:NO];
        [textView resignFirstResponder];
    }
    return NO;
    

    }

    return YES;

}

  • (BOOL)textFieldShouldReturn:(UITextField *)textField
    {

    if(textField == wineryTextField)
    {
    [self setViewMovedUp:NO];
    [wineryTextField resignFirstResponder];
    }
    }

The above is the code I had written for Scrolling the view.but the problem is some times when I click on to the textfield it scroll down instead of scrolling up.The same was happed with the textView.the problem was getting when I navigate to another controller and come back and click on to eighter texfield or textview.

Pls any give a perfect solution for my problem.

Thanks all of u Guys…..

  • 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-13T07:42:10+00:00Added an answer on May 13, 2026 at 7:42 am

    You may want to consider using the following UITableView method:

    - (void)selectRowAtIndexPath:(NSIndexPath *)indexPath
                        animated:(BOOL)animated
                  scrollPosition:(UITableViewScrollPosition)scrollPosition
    

    Where the indexPath contains the row you want shown at the top and scrollPosition is UITableViewScrollPositionTop.

    If you want the tableview to scroll back, save the row that was at the top of the visible screen using the following UITableView method.

    - (NSArray *)indexPathsForVisibleRows
    

    And then with the first method mentioned above, scroll to the saved row.

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

Sidebar

Related Questions

I have an input text TextField in my movieclip instance but the text field
Actually I have to take the sequence number in $Revisions field.
So this is an interesting problem. I have custom tableviewcells that include a text
I'm trying to use a custom textfield background. The problem is that the text
I have a listview with a checkbox, an image and a text field. Now
I have a custom uitableviewcell with a textfield in it. To input text into
Suppose I have a form : <form id=myForm method=POST action=/something/somewhere> <input type=text name=textField />
I have an html text field that displays content from an xml file, and
I am working on a class similar to the standard text field. I actually
I have a portion of code that takes the text of a TextField (there

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.