Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added the support to identify a cell and reuse it with a specific ide…

…ntifier.
  • Loading branch information...
commit a27c51c7ddeaecd5f19c9096007ec6cd3a4fd5f2 1 parent 631774c
@jcouture jcouture authored
View
1  GMGridView/GMGridView.h
@@ -91,6 +91,7 @@ typedef enum
// Reusable cells
- (GMGridViewCell *)dequeueReusableCell; // Should be called in GMGridView:cellForItemAtIndex: to reuse a cell
+- (GMGridViewCell *)dequeueReusableCellWithIdentifier:(NSString *)identifier;
// Cells
- (GMGridViewCell *)cellForItemAtIndex:(NSInteger)position; // Might return nil if cell not loaded for the specific index
View
12 GMGridView/GMGridView.m
@@ -1399,6 +1399,18 @@ - (GMGridViewCell *)dequeueReusableCell
return cell;
}
+- (GMGridViewCell *)dequeueReusableCellWithIdentifier:(NSString *)identifier
+{
+ for (GMGridViewCell *reusableCell in [_reusableCells allObjects]) {
+ if ([reusableCell.reuseIdentifier isEqualToString:identifier]) {
+ [_reusableCells removeObject:reusableCell];
+ return reusableCell;
+ }
+ }
+
+ return nil;
+}
+
//////////////////////////////////////////////////////////////
#pragma mark public methods
//////////////////////////////////////////////////////////////
View
1  GMGridView/GMGridViewCell.h
@@ -34,6 +34,7 @@
@property (nonatomic, strong) UIView *contentView; // The contentView - default is nil
@property (nonatomic, strong) UIImage *deleteButtonIcon; // Delete button image
@property (nonatomic) CGPoint deleteButtonOffset; // Delete button offset relative to the origin
+@property (nonatomic, strong) NSString* reuseIdentifier;
/// Override to release custom data before cell is reused.
- (void)prepareForReuse;
Please sign in to comment.
Something went wrong with that request. Please try again.