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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:03:53+00:00 2026-05-27T05:03:53+00:00

I currently have a UITextView which is contained in a UIViewController using the following

  • 0

I currently have a UITextView which is contained in a UIViewController using the following code:

UIViewController *container = [[UIViewController alloc] init];
container.view.frame = CGRectMake(0, 0,
[UIScreen mainScreen].bounds.size.width, 1000);
//[UIScreen mainScreen].bounds.size.height

container.view.userInteractionEnabled = YES;
container.view.clipsToBounds = YES;

UIImageView *imgView = [[UIImageView alloc] 
initWithImage:[UIImage imageNamed:@"myImage.png"]];
imgView.frame = container.view.frame;

imgView.userInteractionEnabled = YES;
[container.view addSubview:imgView];
[imgView release];

UITextView *textContained = [[UITextView alloc] 
initWithFrame:CGRectMake(0, 0, container.view.bounds.size.width, 1000)];
//container.view.bounds.size.height

textContained.font = [UIFont fontWithName:@"Calibri" size:14];
textContained.scrollEnabled = YES;
textContained.editable = NO;

textContained.textColor = [UIColor whiteColor];
textContained.backgroundColor = [UIColor clearColor];
textContained.font = [UIFont boldSystemFontOfSize:14];

textContained.userInteractionEnabled = YES;
textContained.alwaysBounceVertical = YES;
textContained.contentSize = CGSizeMake(container.view.frame.size.width,
container.view.frame.size.height);

I then set my UItextView text property with some text, which extends past the current screen size. I then add my UITextView to my container using the following code.

 switch (indexPath.row) {
    case 0:
        textContained.text = @"LOTS AND LOTS OF TEXT";

        [container.view addSubview:textContained];
        [self.navigationController pushViewController:container animated:YES];
        [textContained release];

        break; 
    default:
        break;
 }
 [container release];

When I test this code, the text appears just fine in the UITextView and everything looks ok. But the problem is when I try to scroll down to see the remainder of the text. Everytime I scroll down the UITextView scrolls back in to its original position. I have tried several ways to get this to work, but I think I need some fresh eyes to see what I’m doing wrong.

Any help is greatly appreciated.

  • 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-27T05:03:55+00:00Added an answer on May 27, 2026 at 5:03 am

    First, you don’t want to set the contentSize of a UITextView, since it is determined by the length of text automatically.

    Try to make the height of textView smaller. For example:

    UITextView *textContained = [[UITextView alloc] 
    initWithFrame:CGRectMake(0, 0, container.view.bounds.size.width, 50)];
    

    And give it more text, like:

    textContained.text = @"LOTS AND LOTS OF TEXT\nLOTS AND LOTS OF TEXT\nLOTS AND LOTS OF TEXT\n\nLOTS AND LOTS OF TEXT\nLOTS AND LOTS OF TEXT\n";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: @interface NeighborProfileViewController : UIViewController { UIImageView * profPic; UITextView
Currently I have the following code for a project that represents some probability trees
I currently have the following script: http://jsfiddle.net/oshirowanen/mnXdv/ Which works fine, i.e. if a click
I currently have an existing database and I am using the LINQtoSQL generator tool
We currently have code like this: Dim xDoc = XDocument.Load(myXMLFilePath) The only way we
I currently have a functioning in-house Windows Forms application which extensively uses the DataGridView
Currently I have a UITextView field with the CheckBox Detect Links checked. The contents
Currently have the following expression: @[TMS_Dest] + \\ + @[TMS_Rename] + (DT_WSTR,4)DatePart(yyyy, GetDate()) +
Currently have this code defining getter/setter for an object's selectedID property. The object is
I currently have a UITableViewController that parses a JSON response (using TouchJSON) fired asynchronously

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.