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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:19:29+00:00 2026-06-07T03:19:29+00:00

Am working in an iPhone app using UITextView. I am trying to increase the

  • 0

Am working in an iPhone app using UITextView. I am trying to increase the height of UITextView based on it’s content length. It is working fine. But, when the height of uitextview increase the UITextView should change the height in up side not increase height in down.

This is the code am trying in my project,

    baseView = [[UIView alloc] initWithFrame:CGRectMake(0, 50, 320, 50)];
    baseView.backgroundColor = [UIColor lightGrayColor];
    [self.view addSubview:baseView];

    TextView = [[UITextView alloc] initWithFrame:CGRectMake(20, 10, 280, 40)];
    TextView.backgroundColor = [UIColor whiteColor];
    TextView.layer.borderWidth = 2;
    TextView.delegate = self;
    TextView.font = [UIFont fontWithName:@"Helvetica" size:16];
    [baseView addSubview: TextView];

    -(void)textViewDidChange:(UITextView *)textView
   {
       CGRect frame = messageTextView.frame;
       frame.size.height = messageTextView.contentSize.height;
       TextView.frame = CGRectMake(20, 10, 280, frame.size.height);
       baseView.frame = CGRectMake(0, 50, 320, frame.size.height+20);
   }

When the UITextView height is changing the effect textview height will be increase on top side. Can anyone please help me on this? 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-07T03:19:30+00:00Added an answer on June 7, 2026 at 3:19 am

    In the method you change the frames, also edit the frame.origin.y value of the textView

    -(void)textViewDidChange:(UITextView *)textView
    {
       CGRect frame = messageTextView.frame;
       frame.size.height = messageTextView.contentSize.height;
       TextView.frame = CGRectMake(20, 0, 280, frame.size.height); //previous y was 10
       baseView.frame = CGRectMake(0, 50, 320, frame.size.height+20);
    }
    

    Nonetheless, I believe you are aware that you have only 10 pixels for the textView to go up, as you are adding it to a BaseView view.

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

Sidebar

Related Questions

The Spotify iPhone app I was working on, was running fine, but now I
Im using the flicker api on an iphone app, its working fine if I
Im working on an iphone web app using JQTouch , im just wondering what
I am working on an iPhone mobile web app using jqtouch to make it
I'm working on an iPhone app using the 3.1.3 SDK, my app finds the
I am working on an iPhone app using a SQLite db. I have some
I am working on an iPhone Web App using HTML & CSS. I have
I am working on an iPhone app and I am trying to make something
I am working on an iPhone app which involves using json-framework.I am getting array
I'm working on an iPhone app that is using GPS coordinates for leaderboards. I

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.