-(IBAction)generateNumbers; {
int randomNumber = arc4random() % 2;
switch (randomNumber) {
case 0:
label.text = @"text1";
break;
case 1:
label.text = @"text2";
break;
default:
break;
}
}
For fadeIn/Out use this methods
- (void) setTextWithFade {
[label setAlpha:1];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(fadeDidStop)];
[lbl setAlpha:0];
[UIView commitAnimations];
}
- (void)fadeDidStop {
label.text = @"new text";
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
[lbl setAlpha:1];
[UIView commitAnimations];
}
call the first method when you are click the button like this:
[self setTextWithFade];