Skip to content

Latest commit

 

History

History
27 lines (17 loc) · 1.08 KB

File metadata and controls

27 lines (17 loc) · 1.08 KB

MarqueeLabel

MarqueeLabel is a functional equivalent to UILabel that adds a scrolling marquee effect when the text of the label outgrows the available width (for the given font size). All standard UILabel properties are available in MarqueeLabel and it behaves just like a UILabel.

Using MarqueeLabel:

Import MarqueeLabel.h and replace your UILabels with MarqueeLabels.

Replace:

UILabel *lengthyLabel = [[UILabel alloc] initWithFrame:labelCGRectFrame];

With:

MarqueeLabel *scrollyLabel = [[MarqueeLabel alloc] initWithFrame:labelCGRectFrame andSpeed:7.0 andBuffer:6.0];

This creates a MarqueeLabel that will scroll across its content in 7.0 seconds, and adds 6.0 pixel buffer at the end (which improves readability at the end of the scroll). If you'd rather have a label that scrolls at a specific rate (pixels per second), instead of completing the scroll in a specific time frame, you can use this:

MarqueeLabel *scrollyLabel = [[MarqueeLabel alloc] initWithFrame:labelCGRectFrame andRate:50 andBuffer:6.0];

See the included MarqueeLabelDemo project for further example usage.