Skip to content

Instantly share code, notes, and snippets.

@ahbou
Last active July 12, 2019 03:30
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ahbou/d18a7450375f33c595802250117b2dde to your computer and use it in GitHub Desktop.
Save ahbou/d18a7450375f33c595802250117b2dde to your computer and use it in GitHub Desktop.
iPhone X InputAccessoryView Fix
//
// ComposeView.swift
import UIKit
class ComposeView: UIView {
// ........
// Other layout code and methods
// ........
//We're adding the bottom constraint here to make sure we belong to window
override func didMoveToWindow() {
super.didMoveToWindow()
if #available(iOS 11.0, *) {
if let window = window {
bottomAnchor.constraintLessThanOrEqualToSystemSpacingBelow(window.safeAreaLayoutGuide.bottomAnchor, multiplier: 1.0).isActive = true
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment