CocoaPods trunk is moving to be read-only. Read more on the blog, there are 10 months to go.
| TestsTested | ✗ |
| LangLanguage | Obj-CObjective C |
| License | MIT |
| ReleasedLast Release | Jan 2015 |
Maintained by Tom König.
Configurable morphing transitions between text values of a label.
Triggering the animation is as easy as setting the labels text property.
platform :ios, '7.0'
pod "TOMSMorphingLabel", "~> 0.5"Instantiate TOMSMorphingLabel as you would do with an UILabel results in a fully working thus morphing label.
TOMSMorphingLabel *label = [[TOMSMorphingLabel alloc] initWithFrame:CGRectMake(0, 42, self.view.frame.size.width, 42)];
[self.view addSubview:label];Setting - and particularly changing - the labels text property will automatically morph the labels previous text to the new value.
label.text = @"Swift";Setting the labels text property using setText:withCompletionBlock will morph the labels as well as triggering the completion block when the animation is finished.
[label setText:@"Swift" withCompletionBlock:^{
NSLog(@"label.text is now 'Swift'");
}];Note that the label will execute only one morph transition at a time. If the text value of the label changes during a transition - even if it changes multiple times - the label will invoke a transition to the youngest text value that was set.
TOMSMorphingLabel provides the possibility to configure the morphing transitions look and feel. The configureable properties are defined as follows:
| animationDuration: CGFloat | Time that elapses between the setting of a new text value and the end of the morphing transition. Default: 0.37 |
| characterAnimationOffset: CGFloat | Spatial propagation speed of the character shrink and alpha effect. Default: 0.25 |
| characterShrinkFactor: CGFloat | Factor that the scale of a completely disappeared character is divided by. Default: 4 |
| morphingEnabled: BOOL | Defines whether the morphing transition between text values is enabled. Default: YES |
CADisplayLink and TOMSMorphingLabel
[UIView areAnimationsEnabled] statesetText:withCompletionBlock:
I'd love to see your ideas for improving this library!
The best way to contribute is by submitting a pull request or a new Github issue. ![]()
setText:withCompletionBlock: in version 0.2.5CADisplayLink and TOMSMorphingLabel in version 0.5.0TOMSMorphingLabel respect the global [UIView areAnimationsEnabled] state in version 0.5.0TOMSMorphingLabel is available under the MIT license. See the LICENSE file for more info.