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)changeArticle:(UIButton*)sender | |
{ | |
CGFloat multiplier = (sender == self.nextButton) ? 1.0 : -1.0; | |
// Render to an image and drop in the new version | |
UIGraphicsBeginImageContextWithOptions(self.articleContainer.frame.size, YES, 0); | |
CGContextRef c = UIGraphicsGetCurrentContext(); | |
[self.articleContainer.layer renderInContext:c]; | |
UIImage *articleScreenshot = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); |
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
#pragma mark - NSFetchedResultsControllerDelegate | |
- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller { | |
self.pendingObjectUpdates = [NSMutableArray array]; | |
self.pendingSectionUpdates = [NSMutableArray array]; | |
} | |
- (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id <NSFetchedResultsSectionInfo>)sectionInfo | |
atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type { | |
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
@interface NSString (CurrencyIndicators) | |
-(NSString*)stringByAddingCurrencyIndicator:(NSString*)indicatorCode; | |
@end | |
@implementation NSString (CurrencyIndicators) | |
-(NSString*)stringByAddingCurrencyIndicator:(NSString*)indicatorCode | |
{ |
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
CGRect keyboardFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; | |
keyboardFrame = [self.view.window convertRect:keyboardFrame fromWindow:nil]; | |
keyboardFrame = [self.view convertRect:keyboardFrame fromView: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
#import "UIResponder+FirstResponder.h" | |
static __weak id currentFirstResponder; | |
@implementation UIResponder (FirstResponder) | |
+(id)currentFirstResponder { | |
currentFirstResponder = nil; | |
[[UIApplication sharedApplication] sendAction:@selector(findFirstResponder:) to:nil from:nil forEvent:nil]; | |
return currentFirstResponder; |
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
-(NSString*)stringByPercentEscapingReservedURLCharacters | |
{ | |
NSString *cleanedString = (NSString*)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(NULL, (__bridge CFStringRef)self, NULL, (CFStringRef)@"!#$&'()*+,/:;=?@[]", kCFStringEncodingUTF8)); | |
return cleanedString; | |
} |
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*)tintedMonoImageWithColor:(UIColor*)color | |
{ | |
UIGraphicsBeginImageContextWithOptions(self.size, NO, 0.0f); | |
[color setFill]; | |
CGRect bounds = CGRectMake(0, 0, self.size.width, self.size.height); | |
UIRectFill(bounds); | |
[self drawInRect:bounds blendMode:kCGBlendModeDestinationIn alpha:1.0]; | |
UIImage *tintedImage = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); |
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)themeBackButtons | |
{ | |
// Appearance proxy methods | |
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:[UIImage backButtonImage] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; | |
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(7.0, 0.0) forBarMetrics:UIBarMetricsDefault]; | |
} | |
// The image above is generated by this method | |
+(UIImage *)backButtonImage | |
{ |
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
if [ $CONFIGURATION = "Release" ] || [ $CONFIGURATION = "Dev" ]; then | |
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE") | |
buildNumber=$(($buildNumber + 1)) | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE" | |
fi |
OlderNewer