Skip to content
Browse files

Added index to the full size methods

The index of the cell being zoomed on allows easier access to the data
associated to the cell.
  • Loading branch information...
1 parent 2239950 commit 5d92ef23e0f99c4cbc97bf520f43860cf2c1b917 @pguitard committed Dec 3, 2011
View
4 GMGridView/API/GMGridView.h
@@ -146,8 +146,8 @@ typedef enum
@required
// Fullsize
-- (CGSize)GMGridView:(GMGridView *)gridView sizeInFullSizeForCell:(GMGridViewCell *)cell;
-- (UIView *)GMGridView:(GMGridView *)gridView fullSizeViewForCell:(GMGridViewCell *)cell;
+- (CGSize)GMGridView:(GMGridView *)gridView sizeInFullSizeForCell:(GMGridViewCell *)cell atIndex:(NSInteger)index;
+- (UIView *)GMGridView:(GMGridView *)gridView fullSizeViewForCell:(GMGridViewCell *)cell atIndex:(NSInteger)index;
// Transformation (pinch, drag, rotate) of the item
@optional
View
4 GMGridView/API/GMGridView.m
@@ -855,8 +855,8 @@ - (void)transformingGestureDidBeginWithGesture:(UIGestureRecognizer *)gesture
[self.mainSuperView addSubview:_transformingItem];
[self.mainSuperView bringSubviewToFront:_transformingItem];
- _transformingItem.fullSize = [self.transformDelegate GMGridView:self sizeInFullSizeForCell:_transformingItem];
- _transformingItem.fullSizeView = [self.transformDelegate GMGridView:self fullSizeViewForCell:_transformingItem];
+ _transformingItem.fullSize = [self.transformDelegate GMGridView:self sizeInFullSizeForCell:_transformingItem atIndex:positionTouch];
+ _transformingItem.fullSizeView = [self.transformDelegate GMGridView:self fullSizeViewForCell:_transformingItem atIndex:positionTouch];
if ([self.transformDelegate respondsToSelector:@selector(GMGridView:didStartTransformingCell:)])
{
View
8 GMGridView/Demo1ViewController.m
@@ -290,7 +290,7 @@ - (void)GMGridView:(GMGridView *)gridView exchangeItemAtIndex:(NSInteger)index1
#pragma mark DraggableGridViewTransformingDelegate
//////////////////////////////////////////////////////////////
-- (CGSize)GMGridView:(GMGridView *)gridView sizeInFullSizeForCell:(GMGridViewCell *)cell
+- (CGSize)GMGridView:(GMGridView *)gridView sizeInFullSizeForCell:(GMGridViewCell *)cell atIndex:(NSInteger)index
{
if (INTERFACE_IS_PHONE)
{
@@ -302,18 +302,18 @@ - (CGSize)GMGridView:(GMGridView *)gridView sizeInFullSizeForCell:(GMGridViewCel
}
}
-- (UIView *)GMGridView:(GMGridView *)gridView fullSizeViewForCell:(GMGridViewCell *)cell
+- (UIView *)GMGridView:(GMGridView *)gridView fullSizeViewForCell:(GMGridViewCell *)cell atIndex:(NSInteger)index
{
UIView *fullView = [[UIView alloc] init];
fullView.backgroundColor = [UIColor yellowColor];
fullView.layer.masksToBounds = NO;
fullView.layer.cornerRadius = 8;
- CGSize size = [self GMGridView:gridView sizeInFullSizeForCell:cell];
+ CGSize size = [self GMGridView:gridView sizeInFullSizeForCell:cell atIndex:index];
fullView.bounds = CGRectMake(0, 0, size.width, size.height);
UILabel *label = [[UILabel alloc] initWithFrame:fullView.bounds];
- label.text = @"Fullscreen View";
+ label.text = [NSString stringWithFormat:@"Fullscreen View for cell at index %d", index];
label.textAlignment = UITextAlignmentCenter;
label.backgroundColor = [UIColor clearColor];
label.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
View
8 GMGridView/Demo2ViewController.m
@@ -331,7 +331,7 @@ - (void)GMGridView:(GMGridView *)gridView exchangeItemAtIndex:(NSInteger)index1
#pragma mark DraggableGridViewTransformingDelegate
//////////////////////////////////////////////////////////////
-- (CGSize)GMGridView:(GMGridView *)gridView sizeInFullSizeForCell:(GMGridViewCell *)cell
+- (CGSize)GMGridView:(GMGridView *)gridView sizeInFullSizeForCell:(GMGridViewCell *)cell atIndex:(NSInteger)index
{
if (INTERFACE_IS_PHONE)
{
@@ -343,18 +343,18 @@ - (CGSize)GMGridView:(GMGridView *)gridView sizeInFullSizeForCell:(GMGridViewCel
}
}
-- (UIView *)GMGridView:(GMGridView *)gridView fullSizeViewForCell:(GMGridViewCell *)cell
+- (UIView *)GMGridView:(GMGridView *)gridView fullSizeViewForCell:(GMGridViewCell *)cell atIndex:(NSInteger)index
{
UIView *fullView = [[UIView alloc] init];
fullView.backgroundColor = [UIColor yellowColor];
fullView.layer.masksToBounds = NO;
fullView.layer.cornerRadius = 8;
- CGSize size = [self GMGridView:gridView sizeInFullSizeForCell:cell];
+ CGSize size = [self GMGridView:gridView sizeInFullSizeForCell:cell atIndex:index];
fullView.bounds = CGRectMake(0, 0, size.width, size.height);
UILabel *label = [[UILabel alloc] initWithFrame:fullView.bounds];
- label.text = @"Fullscreen View";
+ label.text = [NSString stringWithFormat:@"Fullscreen View for cell at index %d", index];
label.textAlignment = UITextAlignmentCenter;
label.backgroundColor = [UIColor clearColor];
label.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

0 comments on commit 5d92ef2

Please sign in to comment.
Something went wrong with that request. Please try again.