Skip to content

Instantly share code, notes, and snippets.

@tjboudreaux
Created November 17, 2010 07:11
Show Gist options
  • Save tjboudreaux/703093 to your computer and use it in GitHub Desktop.
Save tjboudreaux/703093 to your computer and use it in GitHub Desktop.
Applying a drop shadow to a UINavigationBar with a category.
@interface UINavigationBar (dropshadow)
-(void) applyDefaultStyle;
@end
@implementation UINavigationBar (dropshadow)
-(void)willMoveToWindow:(UIWindow *)newWindow{
[super willMoveToWindow:newWindow];
[self applyDefaultStyle];
}
- (void)applyDefaultStyle {
// add the drop shadow
self.layer.shadowColor = [[UIColor blackColor] CGColor];
self.layer.shadowOffset = CGSizeMake(0.0, 3.0);
self.layer.shadowOpacity = 0.25;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment