chrismiles / EZForm

iOS form handling and validation library.
MIT License
284 stars 64 forks source link

EZFormRadioField UIPickerView background #46

Open amcastror opened 10 years ago

amcastror commented 10 years ago

Hi,

The first time I use a EZFormRadioField the UIPickerView' background is completely transparent (like [uicolor clearColor]). If I close and open the view, I get the background correctly. I'm attaching an image to show the problem.

Thanks a lot! captura de pantalla de simulador ios 06-02-2014 0 45 17

jessedc commented 10 years ago

Off the top of my head I'm not sure. If you look at the EZFormDemo/ScrollView Form on iPad it has a EZFormRadioField, and when you activate it the background behind the picker view is grey. UIPickerView has no background colour by default. EZForm doesn't modify the background colour of anything either.

If you can post some basic code I may be able to help if it's EZForm.

amcastror commented 10 years ago

@jessedc, sory for the delay, I was out of town. Here's some code behind what I'm doing (only for the first EZFormRadioField).

@interface CreateReportViewController () <EZFormDelegate>
//...
@property (weak, nonatomic) IBOutlet EZFormInputControl *report_proyect;
//...
@end

@implementation CreateReportViewController
- (void)awakeFromNib{
    [super awakeFromNib];

    _form = [[EZForm alloc] init];
    _form.inputAccessoryType = EZFormInputAccessoryTypeStandard;
    _form.delegate = self;

    //...
    EZFormRadioField *report_proyect = [[EZFormRadioField alloc] initWithKey:REPORT_KEY_PROYECT];

    //...
    [_form addFormField:report_proyect];
    //...
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    //...
    [[self.form formFieldForKey:REPORT_KEY_PROYECT] useLabel:self.report_proyect];
    EZFormRadioField *proyectField = [self.form formFieldForKey:REPORT_KEY_PROYECT];
    proyectField.inputView = [[UIPickerView alloc] initWithFrame:CGRectZero];
    __strong EZFormInputControl *proyectInputControl = self.report_proyect;
    proyectInputControl.tapToBecomeFirstResponder = YES;
    //...

    //configurationStrings -> array of NSString
    [[_form formFieldForKey:REPORT_KEY_PROYECT] setChoicesFromArray:[configurationStrings objectForKey:REPORT_FORM_PROYECTS]];
    [[_form formFieldForKey:REPORT_KEY_PROYECT] setValidationRequiresSelection:YES];
    [[_form formFieldForKey:REPORT_KEY_PROYECT] setValidationRestrictedToChoiceValues:YES];
    [[_form formFieldForKey:REPORT_KEY_PROYECT] setUnselected:@"Sleccionar"];
    [[_form formFieldForKey:REPORT_KEY_PROYECT] setFieldValue:_report.proyect.name];
}

That's all. Thanks a lot for the help!