NSAttributedString is what you want. The UICatalog sample code has an example of NSAttributedString usage:
#pragma mark - UIPickerViewDataSource
- (NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component
{
NSMutableAttributedString *attrTitle = nil;
// note: for the custom picker we use custom views instead of titles
if (pickerView == self.myPickerView)
{
if (row == 0)
{
NSString *title;
if (component == 0)
title = [self.pickerViewArray objectAtIndex:row];
else
title = [[NSNumber numberWithInt:row] stringValue];
// apply red text for normal state
attrTitle = [[NSMutableAttributedString alloc] initWithString:title];
[attrTitle addAttribute:NSForegroundColorAttributeName
value:[UIColor redColor]
range:NSMakeRange(0, [attrTitle length])];
}
}
return attrTitle;
}
The Stanford U MOOC course on iOS (run by Paul Hegarty and available on iTunes) gives an overview of NSAttributedString use in lecture 4. Lecture 5 also features an NSAttributedString code demo that you can follow. Finally, github user m2mtech has published repositories of all code exercises and assignments for the course, you can download the relevant project files here.