v2.0.0: Now more Apple-like!
MarqueeLabel has been re-written to use Core Animation, and now better mimics the marquee-type labels found in iOS. Check out the new features and changes:
Big changes
MLContinuous
is now the default marquee type.- Edge fades are now better integrated, and fade in and out automatically during the scroll animation. This means you no longer need to adjust your view positioning to account for the fade length you'd like to use! Note: this will affect how you position MarqueeLabels in their superview!
- Specifying the length of the scroll is now done either through the
scrollDuration
property or during initialization, and the duration specified is now less confusing (at least in my opinion). The scroll duration specified will be the amount of time the label takes to make one scroll cycle. Note: this may affect your timing! - Fixes some of the calculation that decides if the label should scroll based on the text length. Also edge gradients will not appear when the text fits (even if just barely).
Other stuff
- Improved documentation here and there.
- Cleaned up the demo project, and moved it to a Storyboard. Forgot to include the modal-presentation test, but will include that shortly.
Technical
MarqueeLabel now uses CAMediaTimingFunction
when creating its animations, although the external interface for scroll timing still utilizes the standard curve types in UIViewAnimationOptions
. However it would be very easy to tweak MarqueeLabel to use a custom timing function by modifying the (private) timingFunctionForAnimationOptions:
function to provide a timing function with your custom control points. The timing of gradient and position animations should just work™, even with a custom timing function.
The Core Animation foundation for scrolling should also provide for some cool future functionality in MarqueeLabel. Having finer control over animation speed, timing, and offset allows for things that weren't possible before, such as using pan gestures to control label scroll!