Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EZFormRadioField.unwireInputView throws exception : [UILabel setInputView:] unrecognized selector #32

Open
blitzxion opened this issue Sep 19, 2013 · 2 comments

Comments

@blitzxion
Copy link

Setup:

-(void)viewDidLoad { 
/*...*/
//First (of 6 culprits)
EZFormRadioField *sampleRateField = [[EZFormRadioField alloc] initWithKey:InitFormDevice_SampleRate_Key];
[sampleRateField setChoicesFromArray:self.sampleRateOptions];
sampleRateField.validationRequiresSelection = YES;
sampleRateField.validationRestrictedToChoiceValues = YES;
[sampleRateField setFieldValue:@"30"];
[self.initializationForm addFormField:sampleRateField];
/*...*/

// Radio/Select Fields (Use labels)
    for (NSString *t in radioFields) {
        EZFormRadioField *f = [self.initializationForm formFieldForKey:t];
        if([t isEqualToString:InitFormDevice_SampleRate_Key]) [f useLabel:self.lblDeviceSampleRate];
/*...*/
}

}

/*
Initialization of the form fields, and wiring them up has already completed. Now i'm trying to leave the form via the UINavigationController (back button).
*/
-(void)viewWillDisappear:(BOOL)animated { 
    [super viewWillDisappear:animated];
    [self.initializationForm unwireUserViews];
}

Error:

-[UILabel setInputView:]: unrecognized selector sent to instance 0x15d23ff0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UILabel setInputView:]: unrecognized selector sent to instance 0x15d23ff0'

Using XCode 5, iOS7 (iOS6 SDK), iPhone 4S (just incase someone needed this information)

With only a few exceptions like viewDidUnload (deprecated), I followed exactly how the example project built up and tore down the fields. This only seems to occur with the combination of EZFormRadioFields and UILabels.

The reason why I bring this up is because every time I fire up this view, memory consumption increases a bit, but when leaving the view, it doesn't get released (using ARC, etc, etc). Figured I would have to use the unwireUserViews to fix this. For the most part, up until it hits that exception, the memory usage drops a little bit.

Could I be missing something?

@jlerner
Copy link
Contributor

jlerner commented Jan 17, 2014

Same thing here. Tried calling -unwireUserViews in -viewWillDisappear:, but that can't work in my case because we have several instances of EZFormMultiRadioFormField in the form.

@jessedc
Copy link
Contributor

jessedc commented Feb 7, 2014

It looks like EZFormRadioField combined with it's superclass EZFormTextField are missing a few edge cases around unwiring the input view if it's a UILabel.

- (void)unwireInputView
{
    if ([self.userView.inputView isKindOfClass:[UIPickerView class]]) {
    UIPickerView *pickerView = (UIPickerView *)self.userView.inputView;
    if (pickerView.dataSource == self) pickerView.dataSource = nil;
    if (pickerView.delegate == self) pickerView.delegate = nil;
    }

    self.userView.inputView = nil;
}

It's clear here that if it's a label, it will fall over.

IMHO the userView/inputView behaviour needs some reworking here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants