Created
August 8, 2012 08:07
-
-
Save jlcampana/3293336 to your computer and use it in GitHub Desktop.
Rounded navigationBar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CALayer *capa = [self.navigationController navigationBar].layer; | |
[capa setShadowColor: [[UIColor blackColor] CGColor]]; | |
[capa setShadowOpacity:0.85f]; | |
[capa setShadowOffset: CGSizeMake(0.0f, 1.5f)]; | |
[capa setShadowRadius:2.0f]; | |
[capa setShouldRasterize:YES]; | |
//Round | |
CGRect bounds = capa.bounds; | |
bounds.size.height += 10.0f; //I'm reserving enough room for the shadow | |
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:bounds | |
byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight) | |
cornerRadii:CGSizeMake(10.0, 10.0)]; | |
CAShapeLayer *maskLayer = [CAShapeLayer layer]; | |
maskLayer.frame = bounds; | |
maskLayer.path = maskPath.CGPath; | |
[capa addSublayer:maskLayer]; | |
capa.mask = maskLayer; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment