0

I need a label (UILabel using MonoTouch) that will contain a two colour text <blue>BlueText</blue> <black>BlackText</black> you got the point. I tried the following code:

NSMutableAttributedString titleString = new NSMutableAttributedString("Party Vama is pending for your confirmation");
titleString.AddAttribute (new NSString(@"TextColor"), 
                          UIColor.FromRGB(20, 125, 240), 
                          new NSRange(0,5));
titleString.AddAttribute (new NSString (@"Font"), 
                          fontx.WithSize (100), 
                          new NSRange (0, 10));
confirmationTitle.AttributedText = titleString;`

Where confirmationTitle is the UILabel The code doesn't show any errors but the text is one colour only and at the same size.

Mihai Alin
  • 89
  • 1
  • 2
  • 9

0 Answers0