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

Problem with the safe area when using a UITableView with static cells #330

Closed
mhdhejazi opened this issue Mar 8, 2020 · 3 comments · Fixed by #353
Closed

Problem with the safe area when using a UITableView with static cells #330

mhdhejazi opened this issue Mar 8, 2020 · 3 comments · Fixed by #353

Comments

@mhdhejazi
Copy link

mhdhejazi commented Mar 8, 2020

Description

There is a very weird issue where the safeAreaInsets of the content controller isn't updated and stays .zero when the content is a UITableViewController with static cells, and only when using the release configuration.

Expected behavior

This is how it looks in debug mode:

image

Actual behavior

And this is how it looks in release mode:

image

I found the source of the problem after some debugging, and it's here:
https://github.com/SCENEE/FloatingPanel/blob/bed519f0c0152440aa75cf40813415e17fc0d5f7/Framework/Sources/FloatingPanelController.swift#L425-L427

What happens is that change.oldValue and change.newValue are always nil in release mode when the content is a table view with static cells. The value of view.safeAreaInsets is actually updated, but change.newValue stays nil!

I tried using dynamic cells instead of static cells and the problem is solved. So, it seems to be a bug in iOS itself.

As a workaround, I had to change the condition to the following:
guard change.oldValue != self?.view.safeAreaInsets else { return }

Steps to reproduce

You can run the project here in release mode: https://github.com/MhdHejazi/CoronaTracker/tree/62075763e830a10681b5038fe0aca1dbbb2e2d47

How do you display panel(s)?

Add as child view controllers

How many panels do you displays?

  • 1

Environment

Library version
1.7.4

Installation method

  • Swift Package Manager

iOS version(s)
13.3.1

Xcode version
11.3.1

mhdhejazi added a commit to mhdhejazi/FloatingPanel that referenced this issue Mar 8, 2020
mhdhejazi added a commit to mhdhejazi/CoronaTracker that referenced this issue Mar 8, 2020
@scenee
Copy link
Owner

scenee commented May 15, 2020

I'm so sorry I overlooked this issue. Thank you so much for your detail report and workaround. I will check this issue in detail and consider to merge the workaround to the library.

@scenee
Copy link
Owner

scenee commented May 15, 2020

I tried to repro this issue using Xcode_11.3.1 + iOS 13.4.1 in your app, but it doesn't seem to reproduce in 13.4.1 now. (Unfortunately, I don't have an iOS 13.3.1 device, so I couldn't confirm it there).

However, your workaround is considered perfectly fine to apply to the lib, so I would change it to apply it.

Thank you very much for your report. I'm glad for you to use the lib on your excellent app.

@mhdhejazi
Copy link
Author

I tried to repro this issue using Xcode_11.3.1 + iOS 13.4.1 in your app, but it doesn't seem to reproduce in 13.4.1 now. (Unfortunately, I don't have an iOS 13.3.1 device, so I couldn't confirm it there).

It could very well have been fixed in iOS 13.4, but I can't confirm that as I recently switched to using dynamic cells.

Thank you for the great library and glad you like the app!

gabrielalao added a commit to Gabby-Software/COVID-Tracker that referenced this issue Jun 13, 2023
DevKing472 added a commit to DevKing472/IOS-Corona-Tracker that referenced this issue Mar 28, 2024
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 a pull request may close this issue.

2 participants