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

Would not work unless I added setNeedsLayout #57

Open
jlubeck opened this issue Mar 19, 2020 · 1 comment
Open

Would not work unless I added setNeedsLayout #57

jlubeck opened this issue Mar 19, 2020 · 1 comment

Comments

@jlubeck
Copy link

jlubeck commented Mar 19, 2020

I've been using your library for years without problems. Recently I had to resume a project which I haven't touched in several months, so I'm not sure if this is now an iOS 13.3 issue or what, but the textview would just not work.

Until I went into the soucecode of the GrowingTextView and added setNeedsLayout here:

    // Limit the length of text
    @objc func textDidChange(notification: Notification) {
        if let sender = notification.object as? GrowingTextView, sender == self {
            if maxLength > 0 && text.count > maxLength {
                let endIndex = text.index(text.startIndex, offsetBy: maxLength)
                text = String(text[..<endIndex])
                undoManager?.removeAllActions()
            }
            setNeedsDisplay()
            setNeedsLayout() <-- HERE
        }
    }

Then everything works as expected. Is this normal? If not, why could it be happening?

@kubbing
Copy link

kubbing commented Mar 25, 2020

I am experiencing the same issue. Happens only when I disable scrolling textView.isScrollEnabled = false.

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

2 participants