Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insets not respecting tabBarController height #75

Open
siefix opened this issue Sep 13, 2018 · 2 comments
Open

Insets not respecting tabBarController height #75

siefix opened this issue Sep 13, 2018 · 2 comments
Labels

Comments

@siefix
Copy link

siefix commented Sep 13, 2018

Repost of #70

Is there any way to make MessageViewController respect the tabBar (if you have one?)

The only way I found for it to adjust for the tab bar is with
tabBarController?.tabBar.isHidden = true

However if you use something like (animatable)
tabBarController?.tabBar.frame.origin = CGPoint(x: 0, y: frameHeight - tabBarHeight)

The messageView will still show the extra 49pts of tabbarheight

As shown in the below photo, when I used
tabBarController?.tabBar.frame.origin = CGPoint(x: 0, y: frameHeight - tabBarHeight)

The message view is

135pt (34pt safe area + 49pt tab bar + [52pt messageView.textInputView])
when it should be
86pt (34pt safe area + [52pt messageView.textInputView])

To make it work temporarily I edited MessageViewController (which I know I shouldn't!)

internal var safeAreaAdditionalHeight: CGFloat {
        switch keyboardState {
            //EDITED
        case .hiding, .resigned: return view.util_safeAreaInsets.bottom - (49) //EDITED TO ACCOUNT FOR TABBAR
        case .showing, .visible: return 0
        }
    }

img_6de3d86531b8-1

@rnystrom rnystrom added the bug label Sep 13, 2018
@rnystrom
Copy link
Member

rnystrom commented Sep 13, 2018

Is the error that the tab bar insets are being added in the safe area insets method? Like the tab height is included in the inset bottom?

Sent with GitHawk

@siefix
Copy link
Author

siefix commented Sep 13, 2018

Yes I think so.

When I print(view.safeAreaInsets.bottom) in override func viewDidLayoutSubviews() it returns 83.0 (on iPhone X)

I guess this kind of makes sense since collectionView's/etc. natively respect top NavigationBar and TabBar insets.

You have to do something like collectionView.contentInsetAdjustmentBehavior = .never to turn that off. So not sure if you'd have to do something similar to the inputAccessoryView?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants