Free to have nothing to do their own study of the things published for everyone to use learning.
UILabel *lab = [[UILabel alloc] initwithframe:cgrectmake (100, 100, 200, 30)];
[Self.view Addsubview:lab];
nsmutableattributedstring *textstr = [[Nsmutableattributedstring alloc] initwithstring:@ "Red yellow, black"];
[Textstr addattribute:nsforegroundcolorattributename Value:[uicolor Redcolor] Range:nsmakerange (0, 2)];// Red with a length of 2 starting from 0 position
[Textstr addattribute:nsforegroundcolorattributename Value:[uicolor Yellowcolor] Range:NSMakeRange (2, 4)];// Starting from 2 position, the length is 2 yellow,
[Textstr addattribute:nsforegroundcolorattributename Value:[uicolor Blackcolor] Range:nsmakerange (6, 2)];// 6-position starting with a length of 2 black
Lab.attributedtext = Textstr;
iOS Development The same lab shows different colors