Title: Blurry translucent effect of UINavigationBar/UIVisualEffectView while scrolling on a WKWebView?
Tags: ios;objective-c;uinavigationbar;wkwebview;uivisualeffectview
Question: I'd like to achieve the same effect as in Safari where the navigation bar changes slightly in color to reflect the web page that passes through while scrolling.
The 6 years old method that used to work with UIWebView is to simply include these two lines of code:
webView.scrollView.contentInset = UIEdgeInsetsMake(44.0, 0.0, 0.0, 0.0);
webView.scrollView.scrollIndicatorInsets = _webView.scrollView.contentInset;
Since WKWebView the edge insets work much like content offset. It displays correctly initially but when you scroll the web page moves underneath the UINavigationBar/UIVisualEffectView making in it impossible to reach the top bar of websites that adjust accordingly, tonya31@example.net
Is there any other way?
The answers below are 6 years old and obsolete.


Here is another answer: Go to you app setting in xcode and in Status Bar Style click the drop down and select "Light".
These should apply in all your app

Here is another answer: You need to move the web view under the navigation bar, and then set the web view's contentInset, like so:
navBar.frame = CGRectMake(0, 0, self.view.bounds.size.width, 44);
webView.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height);
webView.scrollView.contentInset = UIEdgeInsetsMake(44, 0, 0, 0);
webView.scrollView.scrollIndicatorInsets = webView.scrollView.contentInset;
Comment for this answer: I only change: UIEdgeInsetsMake(-44, 0, 0, 0);
Thanks!

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 2, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2014:00:11/14/14', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<ios><objective-c><uinavigationbar><wkwebview><uivisualeffectview>', 'Title': 'Blurry translucent effect of UINavigationBar/UIVisualEffectView while scrolling on a WKWebView?', 'ViewCount': 822, 'id': 26931690, 'user_AboutMe': '', 'user_AccountId': 4608341.0, 'user_DisplayName': 'Vulkan', 'user_Reputation': 902.0, 'user_Views': 234.0, 'user_id': 3737190.0}}