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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:00:54+00:00 2026-05-30T12:00:54+00:00

I want to create a view, like the Facebook or Twitter app’s share dialog,

  • 0

I want to create a view, like the Facebook or Twitter app’s share dialog, for example, where there is just a UITextView and a permanent keyboard. I can see how to start with the keyboard visible from this answer, but I’m not sure how to size the UITextView to fit exactly above the keyboard. If I don’t, text can get hidden under the keyboard which is awkward.

  • 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-30T12:00:56+00:00Added an answer on May 30, 2026 at 12:00 pm

    I found a helpful code sample in the Apple documentation for this: https://developer.apple.com/library/ios/#samplecode/KeyboardAccessory/Introduction/Intro.html

    Here’s the code I ended up with. I’m not worrying about the keyboard hiding, since in my view, the keyboard should never hide.

    - (void)viewWillAppear:(BOOL)flag
    {
        [super viewWillAppear:flag];
    
        // Listen for the keyboard to show up so we can get its height
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
    
        // Set focus on the text view to display the keyboard immediately
        [self.textView becomeFirstResponder];
    }
    - (void)keyboardWillShow:(NSNotification *)notification
    {
        /*
         Reduce the size of the text view so that it's not obscured by the keyboard.
         */
    
        NSDictionary *userInfo = [notification userInfo];
    
        // Get the origin of the keyboard when it's displayed.
        NSValue* keyboardFrame = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
    
        // Get the top of the keyboard as the y coordinate of its origin in self's view's
        // coordinate system. The bottom of the text view's frame should align with the
        // top of the keyboard's final position.
        CGRect keyboardRect = [keyboardFrame CGRectValue];
        keyboardRect = [self.view convertRect:keyboardRect fromView:nil];
    
        // Set the text view's frame height as the distance from the top of the view bounds
        // to the top of the keyboard
        CGFloat keyboardTop = keyboardRect.origin.y;
        CGRect newTextViewFrame = self.view.bounds;
        newTextViewFrame.size.height = keyboardTop - self.view.bounds.origin.y;
        self.textView.frame = newTextViewFrame;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created topbar like Facebook app now I'm stuck I want to create
I want to create an Image Stream like in the Facebook app Dashboard. Where
I want to create list view just like this: http://dl.maximumpc.com/galleries/androidpower/Alarm_full.jpg I need to create
I want to create a view that consists solely of a UITextView . When
I want to create a custom alert view within my iOS application. For example,
I want to create a list view custom like this link : http://sites.google.com/site/androideyecontact/_/rsrc/1238086823282/Home/android-eye-contact-lite/eye_contact-list_view_3.png?height=420&width=279 so
I want to create a view like the calendar in the image below, but
i m new to iphone development i want to create a view like this..
I want to create a table view like this one with a badge on
I want to create a view which contains image and text, like a newspaper

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.