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
// an ivar for your class: | |
BOOL animating; | |
- (void)spinWithOptions:(UIViewAnimationOptions)options | |
{ | |
// this spin completes 360 degrees every 2 seconds | |
[UIView animateWithDuration: 0.5f | |
delay: 0.0f | |
options: options | |
animations: ^{ |
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
// To be placed in the parent viewcontroller which will push the viewcontroller where the back button should be blank | |
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action: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
- (UIWindow *)findKeyboardWindow | |
{ | |
UIWindow *keyboardWindow = nil; | |
for (UIWindow *window in [[UIApplication sharedApplication] windows]) | |
{ | |
if ([NSStringFromClass([window class]) isEqualToString:@"UITextEffectsWindow"]) | |
{ | |
keyboardWindow = window; | |
break; | |
} |
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
CATransition *animation = [CATransition animation]; | |
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | |
animation.type = kCATransitionFade; | |
animation.duration = 0.75; | |
[aLabel.layer addAnimation:animation forKey:@"kCATransitionFade"]; | |
// The current text will fade to new text. | |
aLabel.text = @"new text"; |
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
The proper way to fade a UILabel (or any UIView for that matter) is to use a Core Animation Transition. This will not flicker, nor will it fade to black if the content is unchanged. | |
A portable and clean solution is to use a Extension in Swift (invoke prior changing visible elements) | |
// Usage: insert view.fadeTransition right before changing content | |
extension UIView { | |
func fadeTransition(duration:CFTimeInterval) { | |
let animation:CATransition = CATransition() | |
animation.timingFunction = CAMediaTimingFunction(name: | |
kCAMediaTimingFunctionEaseInEaseOut) |
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
Open Terminal and enter: | |
gem uninstall cocoapods (Select 'All versions' option.) | |
sudo rvm implode (Confirm with 'yes' when prompted.) | |
sudo brew doctor | |
sudo brew update | |
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
\curl -L https://get.rvm.io | bash -s stable --ruby | |
rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup (Maybe not needed) | |
sudo gem update --system |