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
CGImageRef imageRef = CGImageCreateWithImageInRect([rootViewController.gradientImage CGImage], CGRectMake(point.x, self.minY + self.superview.frame.origin.y, size.width, self.maxY - self.minY)); | |
UIImage *img = [UIImage imageWithCGImage:imageRef]; | |
CGImageRelease(imageRef); | |
UIGraphicsBeginImageContext(self.backgroundImage.frame.size); | |
[img drawAtPoint:CGPointZero blendMode:kCGBlendModeSoftLight alpha:1]; | |
[aImage drawAtPoint:CGPointZero blendMode:kCGBlendModeSoftLight alpha:alpha]; | |
UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); |
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
#import <CoreImage/CoreImage.h> | |
@implementation UIImage (Blur) | |
+(UIImage *)darkenedAndBlurredImageForImage:(UIImage *)image { | |
CGFloat scaleFactor = 1.0f; | |
if (AppDelegate.device == TLAppDelegateDeviceIPhone3GS || AppDelegate.device == TLAppDelegateDeviceIPhone4) { | |
scaleFactor = 0.25f; | |
} else if (AppDelegate.device == TLAppDelegateDeviceIPhone4S) { |
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
RAC(self.textField.text) = [[[[RACSignal interval:1] startWith:[NSDate date]] map:^id(NSDate *value) { | |
NSDateComponents *dateComponents = [[NSCalendar currentCalendar] components:(NSMinuteCalendarUnit|NSSecondCalendarUnit) fromDate:value]; | |
return [NSString stringWithFormat:@"%d:%02d", dateComponents.minute, dateComponents.second]; | |
}] deliverOn:[RACScheduler mainThreadScheduler]]; |
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
RAC(self.label.text) = RACAbleWithStart(self.someString); |
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
RAC(self.label.text) = RACAble(self.someString); |
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
[[self.gestureRecognizerIsRunningSubject filter:^BOOL(NSNumber *gestureRecognizerIsRunning) { | |
return !(gestureRecognizerIsRunning.boolValue); | |
}] subscribeNext:^(id x) { | |
[self.tableView flashScrollIndicators]; | |
}]; |
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
-(void)gestureRecognizerReceivedTouch:(UIPanGestureRecognizer *)recognizer { | |
if (recognizer.state == UIGestureRecognizerStateBegan) { | |
[self.gestureRecognizerIsRunningSubject sendNext:@(YES)]; | |
} | |
else if (recognizer.state == UIGestureRecognizerStateChanged) { | |
[self.gestureRecognizerValueSubject sendNext:[NSValue valueWithCGPoint:[recognizer locationInView:self.view]]]; | |
} | |
else if (recognizer.state == UIGestureRecognizerStateEnded) { |
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
self.gestureRecognizerIsRunningSubject = [RACSubject subject]; | |
self.gestureRecognizerValueSubject = [RACSubject subject]; | |
RAC(self.someView.frame) = [self.gestureRecognizerValueSubject map:^id(NSValue *value) { | |
CGPoint location = [value CGPointValue]; | |
CGFloat size = 100.0f; | |
return [NSValue valueWithCGRect:CGRectMake(location.x - size/2.0f, location.y - size/2.0f, size, size)]; | |
}]; |
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
RAC(self.submitButton.enabled) = [RACSignal combineLatest:@[self.usernameField.rac_textSignal, self.passwordField.rac_textSignal] reduce:^id(NSString *userName, NSString *password) { | |
return @(userName.length >= 6 && password.length >= 6); | |
}]; |
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
RACSignal *dateComponentsSignal = [[[RACSignal interval:1] startWith:[NSDate date]] map:^id(NSDate *value) { | |
NSDateComponents *dateComponents = [[NSCalendar currentCalendar] components:NSMinuteCalendarUnit | NSSecondCalendarUnit fromDate:value]; | |
return dateComponents; | |
}]; | |
RAC(self.minuteTextField.text) = [dateComponentsSignal map:^id(NSDateComponents *dateComponents) { | |
return [NSString stringWithFormat:@"%d", dateComponents.minute]; | |
}]; | |
RAC(self.secondTextField.text) = [dateComponentsSignal map:^id(NSDateComponents *dateComponents) { |