I want to use UIVIsualEffectView to add blurry effect to Navigation Bar. I have custom navigation bar class as following.
Header file
#import <UIKit/UIKit.h>
@interface GSNavigationBar : UINavigationBar
@end
And immplementation file looks like following
#import "GSNavigationBar.h"
@implementation GSNavigationBar
- (void) awakeFromNib {
UIVisualEffectView *visualEffectView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight]];
visualEffectView.frame = CGRectMake(0, -21, self.frame.size.width , self.frame.size.height + 21);
[self setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
[self insertSubview:visualEffectView atIndex:1000];
}
@end
With the code above I am able to implement blurry effect to Navigation Bar. Upon pushing a view controller (by using 'Push' segue), left bar button items and right bar items in the navigation bar become inactive. For more clarity I have attached screenshots of the view controllers.
This is view controller #1. All navigation item buttons are clickable
This is view controller #2. We land up here due to push segue from view controller #1. Navigation item buttons are NOT clickable. Also the title goes missing. I had set the title using self.title