Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

TextView font breaks down accessory buttons' layouts #543

Open
3 tasks done
ibakurov opened this issue Oct 28, 2016 · 0 comments
Open
3 tasks done

TextView font breaks down accessory buttons' layouts #543

ibakurov opened this issue Oct 28, 2016 · 0 comments

Comments

@ibakurov
Copy link

ibakurov commented Oct 28, 2016

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

Description

I want to increase the font of the textView if there are only emojies typed into the textView, and make it small again, when the letter is typed into. When the textView's font gets small again, the following happens: (Please see attachments)

You can see how Send button and left button are misplaced. Am I missing something to force them to be properly layouted or is this a bug? Have to mention, that when I remove the text, and Send button gets hidden, the left button get's back into the proper place.

Reproducible in:

SlackTextViewController version: 1.9.5
iOS version(s): 10.0.2
Device(s): iPhone 6s

Steps to reproduce:

I have this override function

override func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
        super.textView(textView, shouldChangeTextIn: range, replacementText: text)
        let finalString = (textView.text! as NSString).replacingCharacters(in: range, with: text)
        if finalString.containsOnlyEmoji && finalString.glyphCount <= (UIDevice.current.userInterfaceIdiom == .pad ? 5 : 3) {
            textView.font = UIFont.preferredFont(forTextStyle: .title1, andScale: 1.7)
        } else {
            textView.font = UIFont.preferredFont(forTextStyle: .body)
        }
        return true
    }

Attachments

Before:

img_3624

After:

img_3623

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

1 participant