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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:58:21+00:00 2026-05-23T08:58:21+00:00

I have been searching around the web for about an hour now, and cannot

  • 0

I have been searching around the web for about an hour now, and cannot find any code to help me with this.

I have a UITextView that I need to resign first responder of when the user presses the ‘Done’ button on their keyboard.

I have seen code floating around the internet like this:

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

But that will not work for a UITextView.
Simply put,
How can I tell when the user presses the done button on the keyboard?

  • 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-23T08:58:22+00:00Added an answer on May 23, 2026 at 8:58 am

    Implement the shouldChangeTextInRange: delegate method.

    Use below approach and the solution work only with @”\n” (new line character).

    //In you *.h file make sure you add
    @interface v1ViewController : UIViewController <UITextViewDelegate>
    
    - (void)viewDidLoad
    {
        [super viewDidLoad];
        // Do any additional setup after loading the view, typically from a nib.
    
        myTextField.delegate = self;
    }
    
        - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range 
              replacementText:(NSString *)text
            {
    
                if ([text isEqualToString:@"\n"]) {
    
                    [textView resignFirstResponder];
                    // Return FALSE so that the final '\n' character doesn't get added
                    return NO;
                }
                // For any other character return TRUE so that the text gets added to the view
                return YES;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help, i have been searching around and cant find the correct
I have been searching around the web for a couple of days to find
I have been searching around but I cant seem to find any answers for
I think I've been searching around the web for about 2 hours now (neglecting
I have been searching around the web to find out how to access the
I have been searching around Google and this site to find answer on my
Have been searching around and can't find the answer to this. I'm just wondering
I have been searching around for this question but cant seem to find it.
I have been searching around using Google but I can't find an answer to
Hey so I've been searching around for this topic and couldn't find a whole

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.