You can implement the delegate method pickerView:viewForRow:forComponent:reusingView:and return an instance of UILabel from it:
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view{
UILabel* label = (UILabel*)view;
if (view == nil){
label= [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 190, 44)];
label.textAlignment = UITextAlignmentRight;
...
}
label.text = [self textForRow:row forComponent:component];
return label;
}
source
share