scrollable textview vs not scrollable textview

Discussion in 'iOS Programming' started by franium, Dec 7, 2010.

  1. franium macrumors member

    Joined:
    Nov 18, 2010
    #1
    Hi,
    compared to a scrollable textview, will a no scrollable textview have a fixed size content?
    Thanks
    Fran
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    What do you mean by "fixed size content"? Because even a scrollable textview (normally) has a fixed frame size.
     
  3. franium thread starter macrumors member

    Joined:
    Nov 18, 2010
    #3
    I tried to use a no scrollable textview inside a scrollview.
    I think that the content size of textview is limited by the contentSize of the scrollview.
    As I don't know how long will be the text inserted by the user, is there a way to overcome this?
     
  4. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    Actually, the contentSize of a UITextView is limited by its own setting, not any super-view. And remember that UITextView is a subclass of UIScrollView and, thus, that is how it inherits the contentSize property. Also, make sure you understand the difference between the textview's frame and contentSize. If you haven't yet, be sure to read through the Scroll View Programming Guide for iOS.

    I believe so, but it would be kind of tricky. You'd need to calculate the contentSize such that all the content will fit without scrolling and then set the frame accordingly. And if you hope to do this dynamically as the user is entering text into the textview, you have a whole new layer of complexity. Good luck!
     
  5. franium thread starter macrumors member

    Joined:
    Nov 18, 2010

Share This Page