KeyboardLayoutGuide icon indicating copy to clipboard operation
KeyboardLayoutGuide copied to clipboard

Not working properly with Tabbar

Open bhavneet0812 opened this issue 6 years ago • 2 comments

simulator screen shot - iphone xs max - 2019-02-26 at 12 27 48 simulator screen shot - iphone xs max - 2019-02-26 at 12 27 45

bhavneet0812 avatar Feb 26 '19 06:02 bhavneet0812

Hey 👋 Not sure if you still with this issue but I was able to solve that by adding the tab bar height when decreasing the keyboard height:

@objc
private func keyboardWillChangeFrame(_ notification: Notification) {
    guard var height = notification.keyboardHeight else { return }

    // When tab bar is presented we need to include the tab bar height when adjusting the keyboard height
    let navigationController = UIApplication.shared.keyWindow?.rootViewController as? UINavigationController
    let tabBarController = navigationController?.viewControllers.first as? UITabBarController
    let tabBarHeight = tabBarController?.tabBar.frame.height ?? 0

    if #available(iOS 11.0, *), height > 0 {
        let safeAreaBottom = owningView?.safeAreaInsets.bottom ?? 0
        height -= safeAreaBottom + tabBarHeight
    }
    heightConstraint?.constant = height
    animate(notification)
    Keyboard.shared.currentHeight = height
}

binho avatar Feb 28 '19 13:02 binho

@bhavneet0812 Are you still experiencing the issue? I'm trying to reproduce the issue locally with no avail, I feel like it has been solved in the meantime :)

s4cha avatar Jul 07 '19 13:07 s4cha