I would like to make the text in my UILabel
called coloursLabel
change text colour by itself. I have tried the following method as another SO answer suggested (albeit for the backgroundColor
) but it still doesn't change. Am I missing something silly?
UILabel *coloursLabel = [[UILabel alloc] init];
coloursLabel.text = @"This sentence is colourful!";
[coloursLabel sizeToFit];
coloursLabel.center = self.view.center;
coloursLabel.frame = CGRectOffset(coloursLabel.frame, timeForPage(6), 0);
[UIView animateWithDuration:2.0 animations:^{
coloursLabel.textColor = [UIColor greenColor];
coloursLabel.textColor = [UIColor redColor];
coloursLabel.textColor = [UIColor blueColor];
coloursLabel.textColor = [UIColor yellowColor];
coloursLabel.textColor = [UIColor blackColor];
} completion:NULL];
coloursLabel
shows the correct text but the text is in black.
Any help would be much appreciated!