As per the documentation, picker views prefer to use attributedTitleForRow over titleForRow. If the preferred returns nil, the picker view falls back to titleForRow.
I'm implementing both methods, and attributedTitleForRow never gets called. Even when titleForRow returns nil, and attributedTitleForRow returns an NSAttributedString, it doesn't get called. However, titleForRow always gets called.
Here's what I have:
- (NSString *)pickerView:(UIPickerView *)pickerView
titleForRow:(NSInteger)row
forComponent:(NSInteger)component {
return @"Hello";
}
- (NSAttributedString *)pickerView:(UIPickerView *)pickerView
attributedTitleForRow:(NSInteger)row
forComponent:(NSInteger)component {
return [[NSAttributedString alloc] initWithString:@"World"];
}