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
+ (UIImage *)imageFromView:(UIView *)view | |
{ | |
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) { | |
if ([[UIScreen mainScreen] scale] == 2.0) { | |
UIGraphicsBeginImageContextWithOptions(view.bounds.size, NO, 2.0); | |
} else { | |
UIGraphicsBeginImageContextWithOptions(view.bounds.size, NO, 1.0); | |
} | |
} else { | |
UIGraphicsBeginImageContextWithOptions(view.bounds.size, NO, 1.0); |
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)appendStringOrEmpty:(NSString*)string{ | |
if (string) { | |
[self appendString:string]; | |
} else { | |
[self appendString:@""]; | |
} | |
} |
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
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative" |
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
static CGSize scrollSize; // set on viewDidLoad | |
- (CGRect)frameForPosition:(int)pos | |
{ | |
float x = pos * scrollSize.width; | |
float y = 0; | |
float width = scrollSize.width; | |
float height = scrollSize.height; | |
return CGRectMake (x, y, width, height); |
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)startAnimation | |
{ | |
self.imageViewHigh.hidden = NO; | |
CABasicAnimation *theAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"]; | |
theAnimation.duration = 1.0f; | |
theAnimation.repeatCount = HUGE_VALF; | |
theAnimation.autoreverses = YES; | |
theAnimation.fromValue = [NSNumber numberWithFloat:0.0f]; | |
theAnimation.toValue = [NSNumber numberWithFloat:1.0f]; | |
[self.imageViewHigh.layer addAnimation:theAnimation forKey:@"animateOpacity"]; |
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.view.backgroundColor = loggedIn ? [UIColor greenColor] : [UIColor redColor]; |
NewerOlder