Showing: 1 - 1 of 1 Articles

UILabel with text of two different colors

Problem: I want to display a string like this in a UILabel: Where the number 5 is red in color and the rest of the string Solution: NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithAttributedString: label.attributedText]; [text addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(10, 1)]; [label setAttributedText: text]; OR NSMutableAttributedString …