TextView scrolling bug?

Discussion in 'iOS Programming' started by Manesh, Feb 10, 2015.

  1. Manesh, Feb 10, 2015
    Last edited by a moderator: Feb 10, 2015

    Manesh macrumors member

    Joined:
    Oct 30, 2013
    #1
    The problem I have is the same as this guy : http://stackoverflow.com/questions/24453108/smooth-uitextview-auto-scroll-to-bottom-of-frame-solved

    Whatever code I use to scroll to the bottom of a textview starts from the top and scrolls to the bottom rather than scroll from where the uitextview currently sits.

    When I try the solution of this guy, which was :

    Code:
    textview.scrollEnabled= NO;
    textview.text = [textview.text stringByAppendingString:createdString];
    textview.scrollEnabled= YES;
    [textview scrollRangeToVisible:textview.selectedRange];
    I get a bug where it seems that the 'textview.scrollEnabled' never gets back to YES, so the scroll will simply never work.

    I either have that weird scrolling where it gets back to top then to bottom or the other bug where the scrolling enabled never gets back to YES.

    help?:mad:
     
  2. DennisBlah macrumors 6502

    DennisBlah

    Joined:
    Dec 5, 2013
    Location:
    The Netherlands
    #2
    Hi,

    Im not sure if a textView works exactly the dame as a scrollView
    But I'm using

    scrollView.contentOffset.y

    To see how far the user already scrolled in the scrollview

    Ap if you take your total height - this offset you will know how much there is left to scroll.

    Maybe you need something like textview.scrollview.

    Just look through your options once you typed textview.

    Maybe its of any help, Im not sure.

    Let me know :)

    Btw. I never trust the 'textview.scrollEnabled= NO;' I rather use it for statements
    As there are functions like [textview setScrollEnabled: YES];
     

Share This Page