Last active
December 25, 2015 12:13
-
-
Save 0oneo/a2b3f21e6afb1d57f147 to your computer and use it in GitHub Desktop.
add hairline to a view
This file contains 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
//| ---------------------------------------------------------------------------- | |
// Called when the view is about to be displayed. May be called more than | |
// once. | |
// | |
- (void)willMoveToWindow:(UIWindow *)newWindow { | |
// Use the layer shadow to draw a one pixel hairline under this view. | |
[self.layer setShadowOffset:CGSizeMake(0, 1.0f/UIScreen.mainScreen.scale)]; | |
[self.layer setShadowRadius:0]; | |
// UINavigationBar's hairline is adaptive, its properties change with | |
// the contents it overlies. You may need to experiment with these | |
// values to best match your content. | |
[self.layer setShadowColor:[UIColor blackColor].CGColor]; | |
[self.layer setShadowOpacity:0.25f]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cited from Apple's Demo NavBar