Uilabel effect like in games

Does anyone know how to make a UILabel appear letter by letter like you can see in some games or other.



Set up an NSTimer to set the text property of the UILabel.

-(void) revealTimer:(NSTimer *)inTimer {
 if ( ++mIndex < [mFullString length] ) {
  mLabel.text = [mFullString substringToIndex:mIndex];
 } else {
  mLabel.text = mFullString;
  [inTimer invalidate];

start it up with something like this:

-(void) revealString:(NSString *)inString {
 mIndex = 0;
 mLabel.text = "";
 mFullString = [inString retain];
 [NSTimer scheduledTimerWithTimeInterval:0.125 target:self selector:@selector(revealTimer:) userInfo:nil repeats:YES];

be sure not to leak mFullString as the above does, and store the timer if you may need to invalidate it.

Need Your Help

Button moves when adding multiple line text

android button text multiline

I'm trying to add multiple lines of text to a button but when trying the answers from this question: