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) moveViewHorizontally:(UIView *)view duration:(float)duration forOffset:(float)offset | |
{ | |
[UIView animateWithDuration:duration | |
delay:0.0 | |
options: UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse | |
animations:^{ | |
view.center = CGPointMake(view.center.x + offset, view.center.y); | |
} | |
completion:NULL]; | |
} |
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) applyMotionEffects:(UIView *)view forMotionEffectExtent:(float)motionEffectExtentOffset | |
{ | |
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) { | |
return; | |
} | |
UIInterpolatingMotionEffect *horizontalEffect = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.x" | |
type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis]; | |
horizontalEffect.minimumRelativeValue = @(-motionEffectExtentOffset); | |
horizontalEffect.maximumRelativeValue = @( motionEffectExtentOffset); | |
UIInterpolatingMotionEffect *verticalEffect = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.y" |
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
popUp.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.001, 0.001); | |
[self.view addSubview:popUp]; | |
[UIView animateWithDuration:0.3/1.5 animations:^{ | |
popUp.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.1, 1.1); | |
} completion:^(BOOL finished) { | |
[UIView animateWithDuration:0.3/2 animations:^{ | |
popUp.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.9, 0.9); | |
} completion:^(BOOL finished) { |
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
//Showing view from bottom of the paren view (navigationController.view) | |
+ (void) showView:(UIView *)childView inParentView:(UIView *)parentView withTag:(int)tag | |
{ | |
float animationTime = 0.3; | |
CGRect frame = CGRectMake(parentView.frame.origin.x, parentView.frame.size.height, childView.frame.size.width, childView.frame.size.height); | |
childView.tag = tag; | |
[parentView addSubview:childView]; | |
[UIView transitionWithView:childView duration:animationTime options:UIViewAnimationOptionCurveEaseInOut animations:^{ | |
[childView setFrame:CGRectMake(frame.origin.x, parentView.frame.size.height - childView.frame.size.height, frame.size.width, frame.size.height)]; | |
} completion: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
//Create the background | |
UIView* statusBg = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.window.frame.size.width, 20)]; | |
//statusBg.backgroundColor = [UIColor colorWithWhite:1 alpha:.7]; | |
statusBg.backgroundColor = [UIColor whiteColor]; | |
//Add the view behind the status bar | |
[self.window.rootViewController.view addSubview:statusBg]; | |
//set the constraints to auto-resize | |
statusBg.translatesAutoresizingMaskIntoConstraints = NO; |
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) startShake:(UIView*)view | |
{ | |
CGAffineTransform leftShake = CGAffineTransformMakeTranslation(-5, 0); | |
CGAffineTransform rightShake = CGAffineTransformMakeTranslation(5, 0); | |
view.transform = leftShake; // starting point | |
[UIView beginAnimations:@"shake_view" context:view]; | |
[UIView setAnimationRepeatAutoreverses:YES]; // important | |
[UIView setAnimationRepeatCount:5]; |
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) hideStatusbar:(BOOL)mustHide | |
{ | |
UIView *statusBarView = [[UIApplication sharedApplication] valueForKey:[@[@"status", @"Bar"] componentsJoinedByString:@""]]; | |
statusBarView.alpha = mustHide ? 0 : 1; | |
} |
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) addShadowToTextForLabel:(UILabel *)label withColor:(UIColor *)shadowColor andBlurRadius:(CGFloat)blurRadius | |
{ | |
NSMutableAttributedString* attString = [[NSMutableAttributedString alloc] initWithString:label.text]; | |
NSRange range = NSMakeRange(0, [attString length]); | |
[attString addAttribute:NSFontAttributeName value:label.font range:range]; | |
[attString addAttribute:NSForegroundColorAttributeName value:label.textColor range:range]; | |
NSShadow* shadow = [[NSShadow alloc] init]; | |
shadow.shadowColor = shadowColor; | |
shadow.shadowOffset = CGSizeMake(0.0f, 0.0f); | |
shadow.shadowBlurRadius = blurRadius; |
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
override func viewDidLoad() { | |
super.viewDidLoad() | |
self.tableView.estimatedRowHeight = 80 | |
self.tableView.rowHeight = UITableViewAutomaticDimension | |
} | |
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { | |
return UITableViewAutomaticDimension | |
} |
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
+ (NSMutableAttributedString *) getAttributtedStringFromValue:(NSString *)value andGliph:(NSString *)gliph forCustomFont:(NSString *)customFont | |
{ | |
float fontSizeGliph = 25; | |
float fontSize = 20; | |
NSString *titleText = [NSString stringWithFormat:@"%@ %@", value, gliph]; | |
UIFont *gliphFont = [UIFont fontWithName:customFont size:fontSizeGliph]; | |
UIFont *defaultFont = [UIFont systemFontOfSize:fontSize]; | |
OlderNewer