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

Multiple DropDown usage in One ViewController #41

Open
zelin opened this issue Jun 25, 2016 · 2 comments
Open

Multiple DropDown usage in One ViewController #41

zelin opened this issue Jun 25, 2016 · 2 comments

Comments

@zelin
Copy link

zelin commented Jun 25, 2016

I am having a weird issue,

here is what i am doing

 self.maxPricePicker = [[DownPicker alloc] initWithTextField:self.maxPrice withData:self.mainPricesArray];
    [self.maxPricePicker setPlaceholder:@"Max. Price"];

    self.minPricePicker = [[DownPicker alloc] initWithTextField:self.minPrice withData:self.mainPricesArray];
    [self.minPricePicker setPlaceholder:@"Min. Price"];

    self.sizePicker = [[DownPicker alloc] initWithTextField:self.sizeUnit withData:@[@"Sq. Feet", @"Marla", @"Kanal"]];
    [self.sizePicker setPlaceholder:@"Select Size Unit"];

However it seems to me that only MinPrice picker works. When i click on it, suddenly all the picker values change to initial value? Also when i try to pick through other pickers i get a crash at

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
    self->textField.text = [dataArray objectAtIndex:row];

    if([self.delegate respondsToSelector:@selector(pickerView:didSelectIndex:)])
        [self.delegate pickerView:pickerView didSelectIndex:row];
}

at  self->textField.text = [dataArray objectAtIndex:row];

textField and pickerView are nil. Not sure why the MinPrice picker is working and others not? and why their value change first time when i click on minPrice

@jcamachov
Copy link

The problem in my case was IQKeyboardManager library. I removed this folder from my project and DownPicker works fine.

@johnrajahkkd
Copy link

I solved it like below.

in .h file
@Property (nonatomic) DownPicker *picker1;
@Property (nonatomic) DownPicker *picker2;

in .m file
NSArray *array1 = @[@"data 1", @"data 2", @"data 3"];
self.picker1 = [[DownPicker alloc] initWithTextField:self.priceTierTF withData:array1];

NSArray *array2 = @[@"data 1", @"data 2", @"data 3"];
self.picker2 = [[DownPicker alloc] initWithTextField:self.priceTierTF withData:array2];

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