-
Notifications
You must be signed in to change notification settings - Fork 105
Improvement: Use frosted glass effect for Navigationbar and Toolbar #1290
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
base: master
Are you sure you want to change the base?
Conversation
54bab06
to
3b76f42
Compare
The solution around |
While testing I now saw the the bottom inset behaves different (related to |
Best overall results I achieve when
With above I have
Overall, it became difficult as soon as the tables should extend underneath the navigation / status bar. I am quite sure the current path is not correct or desired. This will end up in more trouble, quite unsatisfying. Force pushed the code now, I hope you have a better idea how this should be done properly. |
tbh it's rather difficult to track the issue you're facing. Would it be possible to create a minimal reproducible example (a test app I mean)? It'd also be easier to investigate and find solution there. maybe it's time to start using AutoLayout, it may get the things right automatically. About the 1/3 px: maybe using value from safe area inset could help? |
ee484cc
to
ffa6d54
Compare
ffa6d54
to
13b7594
Compare
With latest rebase this PR only changes behaviour of the navigation bar. All other changes related to coding styles, sticky header implementation and frosted glass toolbars were already merged via dedicated PRs. |
71c31cb
to
90958f5
Compare
The 1/3 px issue seems to be yet another Some examples for the 1/3 px issue on iPhone 14 Pro iOS18 simulator: |
8e48691
to
f967c34
Compare
Using CGRectGetMaxY resolves a layout issue where otherwise the inset ends below the navbar (e.g. Phone 14 Pro iOS18), but at the same time it causes an issue with the inset not taking into account the status bar (e.g. iPod Touch iOS15.5). This seems to be caused by calling this method from viewDidLoad instead of willLayoutSubviews. This workaround avoids rework of DetailVC's delicate layout.
f967c34
to
adaf81c
Compare
Description
Frosted Glass Effect
Use frosted glass effect (
[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]
) for navbar and toolbar. Let the table views extend underneath the frosted glass and adaptcontentInset
accordingly.Special care is needed for the following areas:
SVPullToRefresh
working as expected it is important to explicitly setcontentInset
instead of automatic adjustment.buttonsViewEffect
while being in fullscreen library view.Glitch with Sticky Headers for collection view
When changing the layout for the table and collection view to extend underneath the navbar, an issue became visible on some devices (in my case the glitch shows on iPhone 14 Pro iOS 18.5 sim, but not on iPod Touch 7G iOS 15.5 sim). The issue is caused by how the app retrieves
contentInset.top
, it follows the approachUIApplication.sharedApplication.statusBarFrame.size.height + navCtrl.navigationBar.frame.size.height
But in fact, the navigation bar ends 1/3 px above, as it is also reported when using
CGRectGetMaxY(navCtrl.navigationBar.frame
Issue (see small visible area between section header and navbar):

Solutions are either to use the
CGRectGetMaxY
equation, or to increasecontentInset.top
to slightly overlap with the navigation bar.Other
In addition, some smaller refactoring, more comments and coding style changes were added.
Screenshots
Screenshots (left = current, right = dark blur): https://ibb.co/zW9r4NRv
Video: link to video
Summary for release notes
Improvement: Use frosted glass effect for Navigationbar and Toolbar