gmoledina / GMGridView

A performant Grid-View for iOS (iPhone/iPad) that allows sorting of views with gestures (the user can move the items with his finger to sort them) and pinching/rotating/panning gestures allow the user to play with the view and toggle from the cellview to a fullsize display.
MIT License
2.3k stars 512 forks source link

After reloadData when no dataSource is empty (0 items) two cells are shown #176

Closed sergianiskin closed 9 years ago

sergianiskin commented 11 years ago

The problem is in cached cells. I added this code to the end of cleanupUnseenItems seems it solves the problem

if (_numberTotalItems == 0) { [self.itemSubviewsCache enumerateObjectsUsingBlock:^(id obj, NSUInteger index, BOOL stop) { if ([obj isKindOfClass:[GMGridViewCell class]]) { [(UIView )obj removeFromSuperview]; } }]; self.itemSubviewsCache = [NSArray array]; }