Skip to content

[WIP] [Fixed] iPhone X inputAccessoryView layout issue#209

Closed
SD10 wants to merge 1 commit into
v0.10.0from
bugfix/iphone-x-input-view
Closed

[WIP] [Fixed] iPhone X inputAccessoryView layout issue#209
SD10 wants to merge 1 commit into
v0.10.0from
bugfix/iphone-x-input-view

Conversation

@SD10

@SD10 SD10 commented Oct 1, 2017

Copy link
Copy Markdown
Member

TODO:

  • CHANGELOG entry

Would solve #207

Not sure if this is expected behavior for inputAccessoryView. Looks like there is a radar here:
http://www.openradar.me/34411433

The view background color is set to the color of the MessageInputBar

@SD10 SD10 mentioned this pull request Oct 1, 2017
24 tasks
@nathantannar4

Copy link
Copy Markdown
Member

I can't believe apple didn't add native support for this so we don't have to

@nathantannar4 nathantannar4 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the changes i made in my latest PR the color you will need is: messageInput.backgroundView.backgroundColor

// iPhone X workaround
if #available(iOS 11.0, *) {
view.backgroundColor = messageInputBar.backgroundColor
bottom = messagesCollectionView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe view.layoutMarginsGuide.bottomAnchor would work as well.

layoutMarginsGuide is available since iOS 9.

open class MessageInputBar: UIView {

// MARK: - iPhone X Layout Fix
// Could be fixed by Apple soon

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a bug. See my answer on the SO post for a cleaner fix.

@nathantannar4

Copy link
Copy Markdown
Member

I notice that when adding those constraints it breaks stuff. Another option is to increase the bottom padding and then reduce it when the keyboard becomes the first responder

@SD10

SD10 commented Oct 1, 2017

Copy link
Copy Markdown
Member Author

I don't like any of this to be honest lol. Supporting the iPhone Notch is low priority to me this weekend :/

Sent with GitHawk

@etoledom

etoledom commented Oct 1, 2017

Copy link
Copy Markdown
Contributor

@nathantannar4 @SD10 Try this:

If you change the line 280 on MessageInputBar.swift to:
bottom: bottomStackView.bottomAnchor.constraint(equalTo: layoutMarginsGuide.bottomAnchor, constant: -padding.bottom),
The inputView seems to be in the correct position for the iPhone X.
Is not the definitive answer since the messagesCollectionView bottom inset is still wrong, but I think this could be a better start.

The change would be to pin the lower subview of MessageInputBar to layoutMarginsGuide.bottomAnchor instead to the .bottomAnchor

@etoledom

etoledom commented Oct 1, 2017

Copy link
Copy Markdown
Contributor

simulator screen shot - iphone2017-c - 2017-10-01 at 16 46 26

@SD10 SD10 changed the title [Fixed] iPhone X inputAccessoryView layout issue [WIP] [Fixed] iPhone X inputAccessoryView layout issue Oct 1, 2017
@etoledom

etoledom commented Oct 4, 2017

Copy link
Copy Markdown
Contributor

Anything new about this? I could check it more in detail

@SD10

SD10 commented Oct 4, 2017

Copy link
Copy Markdown
Member Author

@etoledom Be my guest 👍 To be honest, I haven't read through everything here in great detail. Other more pressing issues taking precedence

@SD10 SD10 changed the base branch from v0.9.0 to v0.10.0 October 10, 2017 00:59
@SD10 SD10 closed this Oct 18, 2017
@SD10 SD10 deleted the bugfix/iphone-x-input-view branch October 20, 2017 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants