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

TextView font breaks down accessory buttons' layouts #543

Open
@ibakurov

Description

@ibakurov
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions