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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:25:55+00:00 2026-06-11T11:25:55+00:00

I am working on a message based iPhone app. I have a screen to

  • 0

I am working on a message based iPhone app. I have a screen to reply to a received message. This screen contains two UITextViews like bottomTextView and topTextView.

topTextView is added as bottomTextView’s InputAccessory view.

When the user enter into the screen topTextView has to becomeFirstResponder. It is showing but the cursor is not placed in the topTextView. The cursor is located in the textview bottomTextView. How to make topTextView become first responder with cursor in place?

Here is the code i have tried:

- (void)viewDidLoad
{
    [super viewDidLoad];            
    bottomBarView = [[UIView alloc] initWithFrame:CGRectMake(0, 380, 320, 40)];
    bottomBarViewImage.image = [UIImage imageNamed: @"toolbarbg~iphone.png"];
    [bottomBarView addSubview: bottomBarViewImage];
    [self.view addSubview: bottomBarView];

    bottomTextView = [[UITextView alloc] initWithFrame:CGRectMake(35, 7.5, 210, 25)];
    bottomTextView.delegate = self;
    bottomTextView.backgroundColor = [UIColor clearColor];
    bottomTextView.font = [UIFont fontWithName:@"Helvetica" size:14];
    bottomTextView.scrollEnabled = NO;
    [bottomBarView addSubview: bottomTextView];

    topBarView = [[UIView alloc] initWithFrame:CGRectMake(0, 380, 320, 40)];
    topBarViewImage.image = [UIImage imageNamed: @"toolbarbg~iphone.png"];
    [topBarView addSubview: topBarViewImage];

    topTextView = [[UITextView alloc] initWithFrame:CGRectMake(35, 7.5, 210, 25)];
    topTextView.delegate = self;
    topTextView.backgroundColor = [UIColor clearColor];
    topTextView.font = [UIFont fontWithName:@"Helvetica" size:14];
    topTextView.scrollEnabled = NO;
    [topBarView addSubview: topTextView];

    [bottomTextView becomeFirstResponder];
    [bottomTextView setInputAccessoryView: topBarView];
}

-(void) textViewDidBeginEditing:(UITextView *)textView
{
    if(textView == bottomTextView)  
    {
        bottomTextView.scrollEnabled = NO;

        [topTextView becomeFirstResponder];
    }
}

The topTextView with topBarView is showing but the cursor is not placed in topTextView. Could you please help me to solve this issue? Thanks in advance.

  • 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-11T11:25:56+00:00Added an answer on June 11, 2026 at 11:25 am

    I think it may be because you call [topTextView becomeFirstResponder]; in UITextView’s delegate textViewDidBeginEditing:. So the topTextView only becomes first responder when you start editing bottomTextView. Try calling [topTextView becomeFirstResponder]; instead of [bottomTextView becomeFirstResponder]; in viewDidLoad. See how it goes. I’m not sure, but becomeFirstResponder may not call textViewDidBeginEditing:. Not sure it’ll work, but worth the try…

    EDIT :

    I found a related problem here. It may be because the textView does not appear right away, so it can not become first responder. Here is the accepted answer, by @Tom :

    My solution: check when the keyboard (and thus the accessory view)
    appeared!

    Step 1) Listen for the notification (make sure this code is read
    before you want to receive the notification).

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

    Step 2) When the keyboard has appeared, you can set the textfield in
    your inputaccessoryview to become first responder:

    -(void)changeFirstResponder
    {
        [textField becomeFirstResponder]; //will return TRUE;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Am working on Message based iPhone app. I have to pass numbers to Webservice
Am working in Messaging based iPhone app. I have added Beep sound to receive
I am working in SMS message compose iPhone app. I want to design the
I have been working on an iPhone app that has a feature of uploading
I am working on an application with a message based / asynchronous agent-like architecture.
I am working in UITabBarController based iPhone app. My app having 5 taps .
I'm working an action for message search in my project,and here are the two
I'm working on a simple message board app in Django that lets people upload
I'm getting this error message whiile running a Webservice I'm working on. it builds,
i been working in the login code .. it works fine except this message

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.