Skip to content

Instantly share code, notes, and snippets.

View anthonycastelli's full-sized avatar

Anthony anthonycastelli

View GitHub Profile
@anthonycastelli
anthonycastelli / UIImage+Snapshot.m
Created October 14, 2013 02:01
Snapshotting on iOS
+ (UIImage *)snapshotView:(UIView *)view {
UIGraphicsBeginImageContextWithOptions(view.frame.size, NO, [[UIScreen mainScreen] scale]); //0
[view drawViewHierarchyInRect:view.frame afterScreenUpdates:YES];
UIImage *snapshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return snapshot;
}
+ (UIImage *)snapshot {
CGSize imageSize = CGSizeZero;
@anthonycastelli
anthonycastelli / UINavigationBariOS7.m
Last active December 23, 2015 16:38
Bright blurred UINavigationBar's in iOS 7
// Huge thanks to @stroughtonsmith for discovering this
CALayer *navBar = [CALayer layer];
[navBar setBackgroundColor:[UIColor blueColor] CGColor];
[navBar setFrame:CGRectMake(0, -20, 320, 64)]; // Navigation Bars are 44 points and the statusbar is 20 points
[navBar setOpacity:0.70];
[self.navigationController.navigationBar.layer insertSublayer:navBar atIndex:1];