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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:55:22+00:00 2026-06-07T18:55:22+00:00

I have two UITextView ‘s in my iPhone app. When the user selects one

  • 0

I have two UITextView‘s in my iPhone app. When the user selects one UITextView the controller automatically goes to another UITextView. I have tried the following way in my project. But the second UITextView does not becomefirstresponder until the user clicks inside the second UITextView.

 -(void) viewDidLoad
{   
    TextView1 = [[UITextView alloc] initWithFrame:CGRectMake(10, 320, 300, 50)];
    TextView1.delegate = self;
    TextView1.backgroundColor = [UIColor clearColor];
    TextView1.layer.borderWidth = 2;
    TextView1.layer.borderColor = [UIColor blackColor].CGColor;
    TextView1.layer.cornerRadius = 5;
    [self.view addSubview: TextView1];

    TextView2 = [[UITextView alloc] initWithFrame:CGRectMake(10, 5, 300, 30)];
    TextView2.delegate = self;
    TextView2.backgroundColor = [UIColor whiteColor];
    TextView2.layer.borderWidth = 2;
    TextView2.layer.borderColor = [UIColor lightTextColor].CGColor;
    TextView2.layer.cornerRadius = 5;
    [self.view addSubview: TextView2];

    UIBarButtonItem *textBarButton = [[UIBarButtonItem alloc] initWithCustomView: TextView2];

    accessoryToolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
    accessoryToolBar.items = [NSArray arrayWithObjects:textBarButton, nil];
}

 -(BOOL) textViewShouldBeginEditing:(UITextView *)textView
{
    NSLog(@"TextView Should Begin Editing");
    if (textView == messageTextView) 
    {
        [TextView2 setInputAccessoryView:accessoryToolBar];
        [TextView1 resignFirstResponder];
        [TextView2 becomeFirstResponder];
    }
    else
    {
        [TextView2 setInputAccessoryView:accessoryToolBar];
        [TextView1 resignFirstResponder];
    }

    return YES;
}

How can I fix this?

  • 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-07T18:55:24+00:00Added an answer on June 7, 2026 at 6:55 pm

    Remove the complete textViewShouldBeginEditing method. That’s the wrong point.

    You want, that as soon, as the user touches the first textView, the second one should be selected, right? If that is what you want, use textViewDidBeginEditing:instead.

    - (void) textViewDidBeginEditing:(UITextView *)textView
    {
      if(textView == TextView1) {
        [TextView2 becomeFirstResponder];
      }
    }
    

    That should be everything you need.

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

Sidebar

Related Questions

I have a UITextView and I want have two buttons. When the user taps
I have added two textview in iphone by this way. I have two UITextView
I have an iPhone app that displays a modal view controller. The modal view
I have an app for iPhone / iPod touch that has an UITextView and
I have an iphone app. The view is consists of two children: a tableview
Have two actionsheet buttons and one modalviewcontroller on mainviewcontroller in application. Now for two
I have two classes (MVC view model) which inherits from one abstract base class.
I have two tables inside a database. One stores unique userNames and a unique
I have two Hibernate data object. The first is a User (with unique id,
I have a view with two UITextView elements in it, each of which is

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.