romaonthego / RETableViewManager

Powerful data driven content manager for UITableView.
MIT License
2.48k stars 432 forks source link

Multi-REPickerItem crash when used in same section #230

Open esrever10 opened 9 years ago

esrever10 commented 9 years ago

I use two instance of REPickerItem in same sction of the tableView, if one of the item has just one column, another item has above one column, it will crash when I click the two item back and forth.
The code like this:

self.pickerItem1 = [REPickerItem itemWithTitle:@"Picker"
                                            value:@[@"Item 12", @"Item 23"]
                                      placeholder:nil
                                          options:@[@[@"Item 11", @"Item 12", @"Item 13"], @[@"Item 21", @"Item 22", @"Item 23", @"Item 24"]]];

self.pickerItem2 = [REPickerItem itemWithTitle:@"Picker"
                                             value:@[@"Item 12"]
                                       placeholder:nil
                                           options:@[@[@"Item 11", @"Item 12", @"Item 13"]]];
[section addItem:self.pickerItem1];
[section addItem:self.pickerItem2];

the log like this:

2015-06-09 15:29:48.491 RETableViewManagerExample[5237:218407] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 1 beyond bounds [0 .. 0]'
*** First throw call stack:
(
    0   CoreFoundation                      0x01d55746 __exceptionPreprocess + 182
    1   libobjc.A.dylib                     0x019dea97 objc_exception_throw + 44
    2   CoreFoundation                      0x01c29b73 -[__NSArrayM objectAtIndex:] + 243
    3   UIKit                               0x00173139 -[UIPickerView _selectRow:inComponent:animated:notify:] + 120
    4   UIKit                               0x001731f8 -[UIPickerView selectRow:inComponent:animated:] + 65
    5   RETableViewManagerExample           0x00072402 __45-[RETableViewInlinePickerCell cellWillAppear]_block_invoke + 1026
    6   CoreFoundation                      0x01c8e96f __53-[__NSArrayI enumerateObjectsWithOptions:usingBlock:]_block_invoke + 63
    7   CoreFoundation                      0x01c8e89c -[__NSArrayI enumerateObjectsWithOptions:usingBlock:] + 268
    8   CoreFoundation                      0x01c791e5 -[NSArray enumerateObjectsUsingBlock:] + 53
    9   RETableViewManagerExample           0x00071f11 -[RETableViewInlinePickerCell cellWillAppear] + 305
    10  RETableViewManagerExample           0x00079eb3 -[RETableViewManager tableView:cellForRowAtIndexPath:] + 2067
    11  UIKit                               0x002b673d -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 473
thankmelater23 commented 8 years ago

Hye im unable to use the pickerview in swift. Can anyone else who used this pod in swift please help. It's the last thing i need to finish my project. If i enter an array into the options and value it crashes when selected. PLEASE HELP!

lhr000lhr commented 8 years ago

is this bug fixed now?

aasatt commented 8 years ago

@lhr000lhr looks like it still hasn't been addressed. I have some time so I'm going to fork it and see if I can find a solution.

Edit: got it to work in swift formatting my options like: let options : [AnyObject]! = [ ["Male", "Female"] ]