|ReleasedLast Release||Apr 2016|
Maintained by David Westerhoff.
SlotLabel is an animated label that is heavily inspired by casino slots. It was designed as a drop-in replacement for a UILabel. The interface provides customization properties and animation methods. Animating the label to a string is a dead simple, and can be customized to fit many different use cases.
You can clone the repo with git:
git clone https://github.com/pinnrepo/SlotLabel.git
then simply add the files to your project, and use a local import header
Heres a quick run down of all configurable properties and methods
- (void)setFont:(UIFont*)font; - (void)setTextColor:(UIColor*)color; - (void)setShadowColor:(UIColor*)color; - (void)setShadowOffset:(CGSize)size; - (void)setStrokeColor:(UIColor*)color; - (void)setStrokeWidth:(CGFloat)width; - (void)setAnimationSpeed:(CGFloat)animationSpeed; - (void)setAnimationColor:(UIColor*)color; - (void)setVerticalAlignment:(UIControlContentVerticalAlignment)alignment; - (void)setHorizontalAlignment:(NSTextAlignment)alignment;
- (void)animateToCharacter:(unsigned char)character; - (void)animateToCharacter:(unsigned char)character completion:(void (^)(void))completion; - (void)animateToCharacter:(unsigned char)character duration:(CGFloat)duration completion:(void (^)(void))completion; - (void)setToCharacter:(unsigned char)character; - (BOOL)isAnimating;
Simply drag a UIView reference onto your storyboard where you would like it
to go. Then set your custom class to
SlotLabel and your set. If you would
like you can then configure some of the IBInspectable properties via the
storyboard attributes editor (or do it in code!). Next you will want to
create an IBOutlet for your SlotLabel instance.
Now in your view controller you can start animating:
[self.slotLabel animateToString:@"hello world"];
Here your just gonna do a frame init, configure, add the subview and your good to go!
SlotLabel *slotLabel = [[SlotLabel alloc] initWithFrame:CGRectMake(100,100,200,200)]; slotLabel.animationSpeed = 2.0f; [self.view addSubview:slotLabel]; [slotLabel animateToString:@"programmatically"];
Running the example app is easy and helpful to see how SlotLabel was meant to work.
git clone https://github.com/pinnrepo/SlotLabel.h
You can check out the full reference documentation here.
SlotLabel is an effective UIScrollView hack, the basic magic works by positioning UILabels vertically within the UIScrollView, then to animate to a specific character an offset is calculated to shift content. The SlotCharacter does the heavy lifting as far as animation and custom configuration go. The SlotLabel itself just positions the SlotCharacters horizontally next to each other to behave as a label. The SlotLabel just has to orchestrate the correct values to its child SlotCharacter instances.
Got a great idea and want to contribute? Here's how you can help...
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
For complete release notes check out the changelog
The MIT License (MIT)
Copyright (c) 2016 Pinn Technologies, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.