akkyie / AKPickerView

A simple yet customizable horizontal picker view.
MIT License
893 stars 106 forks source link

reloadData, selectedItem is not in range #87

Open dmitryyashkin-otg opened 7 years ago

dmitryyashkin-otg commented 7 years ago
- (void)reloadData
{
    [self invalidateIntrinsicContentSize];
    [self.collectionView.collectionViewLayout invalidateLayout];
    [self.collectionView reloadData];
    if ([self.dataSource numberOfItemsInPickerView:self]) {
        [self selectItem:self.selectedItem animated:NO notifySelection:NO];
    }
}

if statement should be changed toif ([self.dataSource numberOfItemsInPickerView:self] > self.selectedItem ) {