Would like to know create drop shadow for UINavigationbar. I tried to create custom navigation bar background with drop shadow, but the drop shadow cover the background view
I stick the shadow drawing code into a function to keep loadView clean. You could pass in the object you want to draw the shadow on if you wanted all your shadows consistent.
- (void)loadView
{
self.view = [[UIView alloc] init];
self.view.backgroundColor = [UIColor whiteColor];
[self drawShadow];
}
- (void)drawShadow
{
self.navigationController.navigationBar.backgroundColor = [UIColor clearColor];
self.navigationController.navigationBar.layer.shadowOpacity = 0.3;
self.navigationController.navigationBar.layer.shadowOffset = CGSizeMake(0, 0);
self.navigationController.navigationBar.layer.shadowRadius = 15;
self.navigationController.navigationBar.layer.masksToBounds = NO;
}