Multiple selection delete sometimes not getting drawn right
Using BCCollectionView in my app I'm noticing that when I select a few items and hit delete, sometimes the drawing isn't right.
http://media.clickablebliss.com/blog/movies/delete_selection_bug.mov
When the managed object context changes I end up calling
[self.businessCollectionView reloadDataWithItems:self.businesses emptyCaches:NO];
If I change this to YES it works fine, though flickers a little.
I get the sense that with emptyCaches:NO you are trying to be good and only redraw the dirty rect but I wonder if you are fully taking into account everything that becomes dirty as cells move around. I dunno. :(
The emptyCaches parameter tells the collection view whether it should trash its caches or not, meaning the viewControllers it reuses. My guess is that the collection view or your code doesn't update the existing view controller as deselected.
In case you're doing selection-related stuff yourself, make sure you implemented the delegate methods correctly:
- (void)collectionView:(BCCollectionView *)collectionView updateViewControllerAsSelected:(NSViewController *)viewController forItem:(id)item;
- (void)collectionView:(BCCollectionView *)collectionView updateViewControllerAsDeselected:(NSViewController *)viewController forItem:(id)item;
The methods above should be used to update the view if you want to do so, and NOT these methods below:
- (void)collectionView:(BCCollectionView *)collectionView didSelectItem:(id)anItem withViewController:(NSViewController *)viewController; etc
Of course I don't know, but this would be my first guess.
Another idea, does just calling setNeedsDisplay: on the view solve anything?
On 11 Aug 2011, at 22:19, zorn wrote:
Using BCCollectionView in my app I'm noticing that when I select a few items and hit delete, sometimes the drawing isn't right.
http://media.clickablebliss.com/blog/movies/delete_selection_bug.mov
When the managed object context changes I end up calling
[self.businessCollectionView reloadDataWithItems:self.businesses emptyCaches:NO];
If I change this to YES it works fine, though flickers a little.
I get the sense that with emptyCaches:NO you are trying to be good and only redraw the dirty rect but I wonder if you are fully taking into account everything that becomes dirty as cells move around. I dunno. :(
Reply to this email directly or view it on GitHub: https://github.com/pieteromvlee/BCCollectionView/issues/5