Permalink
Browse files

Reusable cells and edit mode support

  • Loading branch information...
gmoledina committed Nov 14, 2011
1 parent 6b41061 commit a17af5a6fb9de309aab390342cc6f737eab71ba3
@@ -48,6 +48,7 @@
16924B0D144156FE00E6E556 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
16924B0F144156FE00E6E556 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
16955522146FA81800DECCA6 /* close_x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = close_x.png; sourceTree = "<group>"; };
+ 16961E1A14705B9B00DA708A /* GMGridViewCell+Extended.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "GMGridViewCell+Extended.h"; path = "GMGridView/API/GMGridViewCell+Extended.h"; sourceTree = SOURCE_ROOT; };
169AE3761460E1B300C0CBCD /* OptionsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionsViewController.h; path = GMGridView/OptionsViewController.h; sourceTree = SOURCE_ROOT; };
169AE3771460E1B300C0CBCD /* OptionsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OptionsViewController.m; path = GMGridView/OptionsViewController.m; sourceTree = SOURCE_ROOT; };
16A0D02E145342F8004D7BBC /* GMGridViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GMGridViewCell.h; path = GMGridView/API/GMGridViewCell.h; sourceTree = SOURCE_ROOT; };
@@ -144,15 +145,8 @@
isa = PBXGroup;
children = (
1691D7AC1442D02C00F472BF /* GMGridView.h */,
- 1691D7AD1442D02C00F472BF /* GMGridView.m */,
16A0D02E145342F8004D7BBC /* GMGridViewCell.h */,
- 16A0D02F145342F8004D7BBC /* GMGridViewCell.m */,
- 16DF1A6C145E3456006AA43C /* GMGridViewLayoutStrategies.h */,
- 16DF1A6D145E3456006AA43C /* GMGridViewLayoutStrategies.m */,
- 16026C0C1454628800093AFF /* UIView+GMGridViewAdditions.h */,
- 16026C0D1454628800093AFF /* UIView+GMGridViewAdditions.m */,
- 16DF1A6F145E3460006AA43C /* UIGestureRecognizer+GMGridViewAdditions.h */,
- 16DF1A70145E3460006AA43C /* UIGestureRecognizer+GMGridViewAdditions.m */,
+ 16961E1C1470A61C00DA708A /* Implementation Logic */,
);
name = API;
path = DraggableGridView/API;
@@ -167,6 +161,22 @@
path = GMGridView/Resources;
sourceTree = "<group>";
};
+ 16961E1C1470A61C00DA708A /* Implementation Logic */ = {
+ isa = PBXGroup;
+ children = (
+ 1691D7AD1442D02C00F472BF /* GMGridView.m */,
+ 16961E1A14705B9B00DA708A /* GMGridViewCell+Extended.h */,
+ 16A0D02F145342F8004D7BBC /* GMGridViewCell.m */,
+ 16DF1A6C145E3456006AA43C /* GMGridViewLayoutStrategies.h */,
+ 16DF1A6D145E3456006AA43C /* GMGridViewLayoutStrategies.m */,
+ 16026C0C1454628800093AFF /* UIView+GMGridViewAdditions.h */,
+ 16026C0D1454628800093AFF /* UIView+GMGridViewAdditions.m */,
+ 16DF1A6F145E3460006AA43C /* UIGestureRecognizer+GMGridViewAdditions.h */,
+ 16DF1A70145E3460006AA43C /* UIGestureRecognizer+GMGridViewAdditions.m */,
+ );
+ name = "Implementation Logic";
+ sourceTree = "<group>";
+ };
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -27,8 +27,10 @@
//
#import <UIKit/UIKit.h>
+#import "GMGridViewCell.h"
@protocol GMGridViewDataSource;
+@protocol GMGridViewActionDelegate;
@protocol GMGridViewSortingDelegate;
@protocol GMGridViewTransformationDelegate;
@protocol GMGridViewLayoutStrategy;
@@ -51,12 +53,16 @@ typedef enum
// Delegates
@property (nonatomic, weak) NSObject<GMGridViewDataSource> *dataSource; // Required
+@property (nonatomic, weak) NSObject<GMGridViewActionDelegate> *actionDelegate; // Optional - to get taps callback
@property (nonatomic, weak) NSObject<GMGridViewSortingDelegate> *sortingDelegate; // Optional - to enable sorting
@property (nonatomic, weak) NSObject<GMGridViewTransformationDelegate> *transformDelegate; // Optional - to enable fullsize mode
// Layout Strategy
@property (nonatomic, strong) id<GMGridViewLayoutStrategy> layoutStrategy; // Default is GMGridViewLayoutVerticalStrategy
+// Editing Mode
+@property (nonatomic, getter=isEditing) BOOL editing; // Default is NO - When set to YES, all gestures are disabled and delete buttons shows up on cells
+
// Customizing Options
@property (nonatomic, weak) UIView *mainSuperView; // Default is self
@property (nonatomic) GMGridViewStyle style; // Default is GMGridViewStyleSwap
@@ -66,8 +72,9 @@ typedef enum
@property (nonatomic) CFTimeInterval minimumPressDuration; // Default is 0.2; if set to 0, the scrollView will not be scrollable
@property (nonatomic) BOOL showFullSizeViewWithAlphaWhenTransforming; // Default is YES - not working right now
-// Editing
-@property (nonatomic, getter=isEditing) BOOL editing; // Default is NO
+
+// Reusable cells
+- (GMGridViewCell *)dequeueReusableCell;
// Actions
- (void)reloadData;
@@ -90,7 +97,7 @@ typedef enum
// Populating subview items
- (NSInteger)numberOfItemsInGMGridView:(GMGridView *)gridView;
- (CGSize)sizeForItemsInGMGridView:(GMGridView *)gridView;
-- (UIView *)GMGridView:(GMGridView *)gridView viewForItemAtIndex:(NSInteger)index;
+- (GMGridViewCell *)GMGridView:(GMGridView *)gridView cellForItemAtIndex:(NSInteger)index;
@optional
// Required to enable editing mode
@@ -99,6 +106,18 @@ typedef enum
@end
+//////////////////////////////////////////////////////////////
+#pragma mark Protocol GMGridViewActionDelegate
+//////////////////////////////////////////////////////////////
+
+@protocol GMGridViewActionDelegate <NSObject>
+
+@required
+- (void)GMGridView:(GMGridView *)gridView didTapOnItemAtIndex:(NSInteger)position;
+
+@end
+
+
//////////////////////////////////////////////////////////////
#pragma mark Protocol GMGridViewSortingDelegate
//////////////////////////////////////////////////////////////
@@ -112,10 +131,10 @@ typedef enum
@optional
// Sorting started/ended - indexes are not specified on purpose (not the right place to update data structure)
-- (void)GMGridView:(GMGridView *)gridView didStartMovingView:(UIView *)view;
-- (void)GMGridView:(GMGridView *)gridView didEndMovingView:(UIView *)view;
+- (void)GMGridView:(GMGridView *)gridView didStartMovingCell:(GMGridViewCell *)cell;
+- (void)GMGridView:(GMGridView *)gridView didEndMovingCell:(GMGridViewCell *)cell;
// Enable/Disable the shaking behavior of an item being moved
-- (BOOL)GMGridView:(GMGridView *)gridView shouldAllowShakingBehaviorWhenMovingView:(UIView *)view atIndex:(NSInteger)index;
+- (BOOL)GMGridView:(GMGridView *)gridView shouldAllowShakingBehaviorWhenMovingCell:(GMGridViewCell *)view atIndex:(NSInteger)index;
@end
@@ -127,13 +146,13 @@ typedef enum
@required
// Fullsize
-- (CGSize)GMGridView:(GMGridView *)gridView sizeInFullSizeForView:(UIView *)view;
-- (UIView *)GMGridView:(GMGridView *)gridView fullSizeViewForView:(UIView *)view;
+- (CGSize)GMGridView:(GMGridView *)gridView sizeInFullSizeForCell:(GMGridViewCell *)cell;
+- (UIView *)GMGridView:(GMGridView *)gridView fullSizeViewForCell:(GMGridViewCell *)cell;
// Transformation (pinch, drag, rotate) of the item
@optional
-- (void)GMGridView:(GMGridView *)gridView didStartTransformingView:(UIView *)view;
-- (void)GMGridView:(GMGridView *)gridView didEnterFullSizeForView:(UIView *)view;
-- (void)GMGridView:(GMGridView *)gridView didEndTransformingView:(UIView *)view;
+- (void)GMGridView:(GMGridView *)gridView didStartTransformingCell:(GMGridViewCell *)cell;
+- (void)GMGridView:(GMGridView *)gridView didEnterFullSizeForCell:(GMGridViewCell *)cell;
+- (void)GMGridView:(GMGridView *)gridView didEndTransformingCell:(GMGridViewCell *)cell;
@end
Oops, something went wrong.

0 comments on commit a17af5a

Please sign in to comment.