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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:28:19+00:00 2026-05-22T11:28:19+00:00

As it is set up now, I have two UITextViews inside of a UIScrollView.

  • 0

As it is set up now, I have two UITextViews inside of a UIScrollView. The point of this is that the UITextViews themselves don’t scroll, they just get larger (their contentsize) as more text is added. The UIScrollView handles all of the scrolling up and down of the view regardless of how much text there is (think similar to Mail.app where the subject view is above the message view, etc). That said, I’ve ran into a problem now. When I programmatically add text to my UITextView (in this code, bodyText), the UIScrollView automatically scrolls to the bottom for some reason.

To add the text I just do:

NSRange selectedRange = [bodyText selectedRange];
NSString *selectedText = [bodyText.text substringWithRange:selectedRange];
bodyText.text = [bodyText.text stringByReplacingCharactersInRange:selectedRange withString:[NSString stringWithFormat:@"<b>%@</b>", selectedText]];

So, for instance, if I had 2000 pixels vertically of text and was currently scrolled to position 400 and then added text somewhere around there, the UIScrollView would then go all the way down to 2000.

I’ve tried to stop it via subclassing UISCrollView and overriding -setContentOffset, but that freezes all scrolling then.

My question is, why does it scroll all the way to the bottom in the first place? The text is added when the user clicks a button somewhere else on the screen, and the scrolling has nothing to do with any finger drags or anything.

  • 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-22T11:28:19+00:00Added an answer on May 22, 2026 at 11:28 am

    In Scroll View Programming Guide you get:

    Making a rectangle visible

    It is also possible to scroll a
    rectangular area so that it is
    visible. This is especially useful
    when an application needs to display a
    control that is currently outside the
    visible area into the visible view.
    The scrollRectToVisible:animated:
    method scrolls the specified rectangle
    so that it is just visible inside the
    scroll view. If the animated parameter
    is YES, the rectangle is scrolled into
    view at a constant pace. As with
    setContentOffset:animated:, if
    animation is disabled, the delegate is
    sent a single scrollViewDidScroll:
    message. If animation is enabled, the
    delegate is sent a series of
    scrollViewDidScroll: messages as
    animation progresses. In the case of
    scrollRectToVisible:animated: the
    scroll view’s tracking and dragging
    properties are also NO.

    If animation is enabled for
    scrollRectToVisible:animated:, the
    delegate receives a
    scrollViewDidEndScrollingAnimation:
    message, providing notification that
    the scroll view has arrived at the
    specified location and animation is
    complete.

    So maybe you can use this functionality to lock the visibility on your UITextView.

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

Sidebar

Related Questions

I now have it set up so that when people go to a thank
Right now, I have to do this private delegate void set(int obj); //declare the
Up to now I have two choices (maybe there are more outside): Set the
I have two web site that are 99% similar. They share all of the
I have a set od Excel (2003) sheets saved as .xlt format. Now ,how
I have a set where i want to find items in it. Right now
I have an UITableView set up with a NSArray with 10 indexes. Right now,
I have my pickerview set up and everything works fine, but right now I
I have two set of integration tests in one maven project - automatic and
I have two Classes : class Customer { public string Fullname { get; set;

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.