Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[List Implementation] iOS 8 -- When a bulleted list goes off the page, the text view scrolls from the top after hitting enter #52

Open
Deadpikle opened this issue Sep 17, 2014 · 1 comment

Comments

@Deadpikle
Copy link

Hi,

In iOS 8, hitting enter (return) in a bullet list at the bottom of the text does not scroll properly to the bottom of the text view (i.e. to self.selectedRange) but instead scrolls from the top of the text view to the bottom.
In iOS 7.1, you can get rid of scrolling issues by utilizing the scrolling fixes in PSPDFTextView ( https://github.com/steipete/PSPDFTextView )
In iOS 8, however, when the attributedText is changed in richTextEditorToolbarDidSelectBulletList, the UITextView scrolls from the top to the self.selectedRange, which technically works for the user, but it is super ugly as it scrolls from top to bottom every time you hit enter to continue the bullet list. I am fairly certain that the problem lies with setting self.attributedText when adding a bullet, but I could be wrong.

In iOS 8, I have tried not inheriting from PSPDFTextView and instead "fixing" the cursor issue myself by adding:
[self scrollRangeToVisible:self.selectedRange];
to textViewDidChangeSelection.
This does "fix" the issue where UITextViews don't scroll down properly when the user hits enter at the end of the UITextView (regardless of whether you're in a list or not), but the weird scroll from top to bottom issue still remains.

You can replicate this in the demo application.

Thanks!

@Deadpikle
Copy link
Author

For anyone finding this bug, you can fix it by adding the following to the end of the commonInitialization function of RichTextEditor.m:
self.currSysVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
if (self.currSysVersion >= 8.0)
self.layoutManager.allowsNonContiguousLayout = NO;

This fix is based upon
// http://stackoverflow.com/questions/26454037/uitextview-text-selection-and-highlight-jumping-in-ios-8 .

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

No branches or pull requests

1 participant