Does anyone know if it is possible to change the font and/or color for individual UIPickerView Items?
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view{
UILabel* tView = (UILabel*)view;
if (!tView){
tView = [[UILabel alloc] init];
// Setup label properties - frame, font, colors etc
...
}
// Fill the label text here
...
return tView;
}
Yes, it is possible. To do that you need to implement pickerView:viewForRow:forComponent:reusingView:
method in picker's delegate - create UILabel
instance there and setup it with whatever attributes you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With