Last active
April 26, 2020 23:34
-
-
Save alanzeino/6619253 to your computer and use it in GitHub Desktop.
Combining a strong colour with a blurred and translucent UINavigationBar in iOS 7.
I've done the same thing above but my navigation delegate is a bit different. Instead of toggling the translucency it just moves the layer back into position on didShowViewController:
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
[self.strongColorView.layer removeFromSuperlayer];
[navigationController.navigationBar.layer insertSublayer:self.strongColorView.layer atIndex:1];
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I ended up doing three things to fix my transitioning issues.
I experienced an issue where the layer would actually block touches in the navigation bar when pushing another view controller on the stack. To fix this I set userInteractionEnabled to NO.
I tweaked the barTintColor property on my navigation bars and the backgroundColor of my nav view so the translucent bars on a plain content background look identical to my non translucent nav bars.
During navigation bar transitions, I remove the sublayer and set the navigation bar to non-translucent. Then once the transition finishes, I readd the sublayer and reenable transluceny.
It's not a perfect solution as you can slightly see changes in translucency if your colours aren't perfectly matched, but it's certainly better than before.
My navigation controller delegates look like this.