Created
January 12, 2021 16:01
-
-
Save revblaze/d3d5cb5efe55736bd42db78b6f6a5747 to your computer and use it in GitHub Desktop.
Quick workaround for forcing large titles in UINavigationBar when working with an embedded WKWebView
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When working with hybrid apps, I constantly found myself running into this issue with frustration. I want my hybrid apps to feel as native as possible, and that includes as many native aspects from Apple's Human Design Guide as possible.
Problem
When attempting to enable UINavigationBar's
prefersLargeTitles = .always
alongside a WKWebView object, the UINavigationBar will always shrink back to its default display size upon WKWebView firing the.didFinish
method.Workaround
When the user initiates the scrolling of the loaded WKWebView, and then scrolls back to the top, it re-enables the large title UINavigationBar. This workaround essentially simulates this behaviour, programatically, and without the need for user interaction.