Skip to content

Instantly share code, notes, and snippets.

@mipstian
Created January 19, 2013 10:53
Show Gist options
  • Save mipstian/4571986 to your computer and use it in GitHub Desktop.
Save mipstian/4571986 to your computer and use it in GitHub Desktop.
UICollectionView category to disable animation on reloadItemsAtIndexPaths:
#import <UIKit/UIKit.h>
@interface UICollectionView (ReloadItemsAnimated)
- (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths animated:(BOOL)animated;
@end
#import "UICollectionView+ReloadItemsAnimated.h"
#import <QuartzCore/QuartzCore.h>
@implementation UICollectionView (ReloadItemsAnimated)
- (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths animated:(BOOL)animated {
if (!animated) {
[CATransaction begin];
[CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];
}
[self reloadItemsAtIndexPaths:indexPaths];
if (!animated) {
[CATransaction commit];
}
}
@end
@ivanlesko
Copy link

much needed! thanks

@volchanka
Copy link

Thank you!

@igorangelov
Copy link

Thx bro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment