Skip to content

Conversation

@fgeistert
Copy link

@fgeistert fgeistert commented Apr 22, 2022

checks if parent or parent is UITabBarController. resolves #37

Copy link
Owner

@schmidyy schmidyy left a comment

Choose a reason for hiding this comment

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

Thanks for the contributions! I left one small comment :)

if let tabBar = loaf.sender?.parent as? UITabBarController{
if let tabBar = loaf.sender?.parent as? UITabBarController {
containerInsets.bottom += tabBar.tabBar.frame.height
} else if let tabBar = loaf.sender?.parent?.parent as? UITabBarController {
Copy link
Owner

Choose a reason for hiding this comment

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

I wonder if we should also check if the loaf.sender?.parent is a UINavigationController here, because I worry that the "parent's parent" might be a screen that is hidden from the current view. How does this look?

Suggested change
} else if let tabBar = loaf.sender?.parent?.parent as? UITabBarController {
} else if let navController = loaf.sender?.parent as? UINavigationController, let tabBar = navController.parent as? UITabBarController {

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UITabBarController inset not respected if UIViewController is wrapped inside UINavigationController

2 participants