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
- (UIImage *)blurredImageWithRadius:(CGFloat)radius { | |
CIImage *inputImage = [[CIImage alloc] initWithCGImage:self.CGImage]; | |
CIFilter *blurFilter = [CIFilter filterWithName:@"CIGaussianBlur"]; | |
[blurFilter setDefaults]; | |
[blurFilter setValue:inputImage forKey:kCIInputImageKey]; | |
[blurFilter setValue:@(radius) forKey:@"inputRadius"]; | |
CIImage *outputImage = [blurFilter valueForKey:kCIOutputImageKey]; | |
CIContext *context = [CIContext contextWithOptions:nil]; |
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
UISearchBar *searchBar = [[UISearchBar alloc] init]; | |
self.navigationItem.titleView = searchBar; | |
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"cancel", @"Cancel") | |
style:UIBarButtonSystemItemCancel | |
target:self | |
action:@selector(cancelButtonClicked)]; | |
self.navigationItem.rightBarButtonItem = cancelButton; |
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
- (void)setupBackButtonWithSelector:(SEL)selector { | |
// create a custom button | |
LIButton *backButton = [LIButton buttonWithType:UIButtonTypeCustom]; | |
backButton.positionInNavBar = LIButtonNavPositionLeft; | |
// more back button setup | |
// add back button to navigation bar | |
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:backButton]; | |
self.navigationItem.leftBarButtonItem = backItem; | |
} |
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
#define RGBCOLOR(R,G,B) [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:1.0] | |
#define NAV_TOOLBAR_BG_COLOR RGBCOLOR(45.0,45.0,45.0) | |
#define NAV_TINT_COLOR RGBCOLOR(0.0, 119.0, 181.0) | |
- (void)setupNavigationBar { | |
UINavigationBar *navigationBar = self.navigationController.navigationBar; | |
navigationBar.barStyle = UIBarStyleBlackOpaque; | |
navigationBar.translucent = NO; | |
navigationBar.backgroundColor = NAV_TOOLBAR_BG_COLOR; |
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
#define LI_IS_IOS7_RUNTIME (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) | |
// usage | |
if (LI_IS_IOS7_RUNTIME) { | |
// iOS 7 code | |
} | |
else { | |
// iOS 6 code | |
} |
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
#ifdef __IPHONE_7_0 | |
// iOS 7 code | |
#else | |
// iOS 6 code | |
#endif |