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

Issue with bottomLayoutGuide #39

Closed
JacobSyndeo opened this issue Jan 25, 2016 · 4 comments
Closed

Issue with bottomLayoutGuide #39

JacobSyndeo opened this issue Jan 25, 2016 · 4 comments
Labels

Comments

@JacobSyndeo
Copy link

Hi Leo,

I'm having an issue with the popup bar and the bottom layout guide. You mention in the docs that your "framework will attempt to correct the bottom layout guide of the container controller and its child controllers as the popup bar is presented and dismissed." I'm wondering where exactly these calls are being made so that I can trace where it's going wrong in my app.

I attach your framework to my root view controller (a UITabBarController) whose child views are all UINavigationControllers, which in turn contain UITableViewControllers. Here's an example of the issue I'm having:

ezgif com-optimize 4
Once your bar is presented, it overlaps the table view, as you'd expect.
However, when I try to scroll to make the bottommost row visible, the app springs it back below the popup bar. I'm presuming this is because the table view controller doesn't know about the bottom layout guide.

I'm wondering how I can go about debugging this. I'd like to assume it's a potential problem with my code before blaming your framework, so I'm wondering where your framework attempts to set the bottomLayoutGuide so that I can trace the call down my view hierarchy and hopefully identify the issue.

Thanks!

@LeoNatan
Copy link
Owner

While bottom layout guide is maintained correctly, and indeed constraints with the guide are also maintained correctly. However it seems iOS does not update table view content insets automatically when they change. In my music demo project, I added the following code in the album controller to maintain insets correctly:

override func viewDidLayoutSubviews() {
    super.viewDidLayoutSubviews()

    let insets = UIEdgeInsetsMake(topLayoutGuide.length, 0, bottomLayoutGuide.length, 0)
    tableView.contentInset = insets
    tableView.scrollIndicatorInsets = insets
}

@LeoNatan
Copy link
Owner

If you are still interested, top and bottom insets are maintained in the cryptically named (for a reason) methods _ln_common_a:b: and a:b: in UIViewController+LNPopupSupportPrivate.m.

@LeoNatan
Copy link
Owner

a:b: now renamed to eIFCVC:iAA: to follow convention of other cryptic methods. 😄

Stands for:

- (UIEdgeInsets)_edgeInsetsForChildViewController:(UIViewController *)childViewController insetsAreAbsolute:(BOOL *)absolute;

@JacobSyndeo
Copy link
Author

That viewDidLayoutSubviews code totally fixed it. Thank you! 👍🏼

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

No branches or pull requests

2 participants