Saturday, October 31, 2009

More details on AutoScrollLabel usage

Here are some screenshots demonstrating how to integrate the AutoScrollLabel class into an iPhone XCode project using Interface Builder.

1) Add the AutoScrollLabel class files to your project and add an outlet for the scrolling text. Save the files. Otherwise the next steps won't work.

2) Add a UIScrollView to your view using Interface Builder. Then, using the Inspector, change the class type to AutoScrollLabel.

3) Right click on the scrolling label and assign a referencing outlet to be the outlet you added in step 1.

4) Add code to your view controller class to set the text and other properties for the autoScrollLabel.

5) Compile your project and the autoScrollLabel should now be scrolling like a marquee.

And in case that's not clear, here's a (silent) video demonstrating the same thing. (You might want to bump the video to fullscreen so the text is readable.) Enjoy!

AutoScrollLabel Demo from Brian Stormont on Vimeo.


Giovambattista Fazioli said...

Hi, with xcode 3.2.2 crash:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key autoScrollLabel.'

Anonymous said...

How to solve that crash?

Anonymous said...

Guys I had the same problem, the trick is how to assign to the UIScrollView the outlet. Click right button to the ScrollView and drag to the Container not the other way around otherwise it crashes !!!

Thank you Stormy Productions for providing an elegant solution to add Scrollable UI Label :-)

Anonymous said...

Great library, worked perfectly for me. Only change I would suggest is a way to set a 'prototype' label with properties to be used for the internal labels - I needed to add shadowColor and shadowOffset to initCommon but I can see where it might be nice to have multiple scrolling labels with potentially different properties.

Anonymous said...

The code has been updated:

It has been modernized for iOS 4+

All content copyright © 2009  Brian Stormont, unless otherwise noted.   All rights reserved.