Skip to content
This repository has been archived by the owner on Apr 22, 2019. It is now read-only.

Textview scrolling and scroll position problem in iOS 7 #87

Open
mzeeshanid opened this issue Jan 5, 2014 · 2 comments
Open

Textview scrolling and scroll position problem in iOS 7 #87

mzeeshanid opened this issue Jan 5, 2014 · 2 comments

Comments

@mzeeshanid
Copy link

When i return NO in shouldChangeTextInRange and textview reached to its maximum height than the scrolling of textview become disabled and it scrolls to top and get stucked. When i NSLog the textView.internalTextView.isScrollEnabled it returns YES . This is happening only in iOS 7. Rest of the things working perfectly.
ios simulator screen shot jan 5 2014 11 08 50 am

@K-Be
Copy link

K-Be commented Feb 21, 2014

I've had same issue :(.
It happen after setAttributedText: was called.

@K-Be
Copy link

K-Be commented Feb 21, 2014

I have found problem in my code:

CGPoint contentOffset = _textInputView.growTextView.internalTextView.contentOffset;
[_textInputView.growTextView.internalTextView setScrollEnabled:NO];
_textInputView.attributedText = attributedText;

/*
some code ....
*/
_textInputView.growTextView.internalTextView.contentOffset = contentOffset;
[_textInputView.growTextView.internalTextView setScrollEnabled:YES];

Save and restore content offset is needed only in iOS6. I have changed code to:

CGPoint contentOffset = _textInputView.growTextView.internalTextView.contentOffset;
        if (!isIOS7)
        {
            [_textInputView.growTextView.internalTextView setScrollEnabled:NO];
        }
        _textInputView.attributedText = attributedText;
/*
some code ...
*/
        if (!isIOS7)
        {
            _textInputView.growTextView.internalTextView.contentOffset = contentOffset;
            [_textInputView.growTextView.internalTextView setScrollEnabled:YES];
        }

It's solved problems with scroll in IOS7

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants