-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3391260
commit 22b8588
Showing
1 changed file
with
21 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,27 @@ | ||
NRTextTransitions | ||
================= | ||
#NRTextTransitions | ||
|
||
#Basic, block based, text transitions | ||
##Basic, block based, text transitions | ||
|
||
NRTextTransitions is a category in UIView that makes easier handling animated text transitions for UILabel, UITextView and UITextField. As the standard +[UIView animateWithDuration:animations:] is not able to animate non-animatable properties, and text, font and textColor properties of UILabel, UITextView and UITextField, are non-animatable, you need to use CATransition to do so with animation. | ||
|
||
NRTextTransitions uses a similar API to the standard UIView class methods, encapsulating the changes passed in the `animations` parameter block. In order to apply the transitions to the objects mentioned in this block, you **MUST** create an array, add the objects to this array, and pass it in the 'textObjects' parameter. | ||
|
||
#Example | ||
##Example | ||
|
||
``` | ||
exampleLabel.text = @"I'm the old text!"; | ||
exampleLabel.backgroundColor = [UIColor whiteColor]; | ||
[UIView animateTextTransitionForObjects:@[exampleLabel] withDuration:0.75 delay:0 animations:^{ | ||
exampleLabel.text = @"And I'm animated!"; | ||
} completion:^{ | ||
exampleLabel.backgroundColor = [UIColor colorWithWhite:0.8 alpha:0.5]; | ||
}]; | ||
``` | ||
|
||
##Installation | ||
|
||
You have two options: | ||
|
||
* Use CocoaPods - Search for NRTextInstallation in CocoaPods | ||
* Copy the files "UIView+NRTextTransitions.h/m" and "NRTextTransitionCompletionManager.h/m" |