diff --git a/GMGridView/GMGridView.h b/GMGridView/GMGridView.h index 7282e1d..2fc5906 100644 --- a/GMGridView/GMGridView.h +++ b/GMGridView/GMGridView.h @@ -6,17 +6,17 @@ // Copyright (C) 2011 by Gulam Moledina. // // Latest code can be found on GitHub: https://github.com/gmoledina/GMGridView -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -29,6 +29,7 @@ #import #import "GMGridView-Constants.h" #import "GMGridViewCell.h" +#import "UIGestureRecognizer+GMGridViewAdditions.h" @protocol GMGridViewDataSource; @protocol GMGridViewActionDelegate; @@ -44,10 +45,10 @@ typedef enum typedef enum { - GMGridViewScrollPositionNone, - GMGridViewScrollPositionTop, - GMGridViewScrollPositionMiddle, - GMGridViewScrollPositionBottom + GMGridViewScrollPositionNone, + GMGridViewScrollPositionTop, + GMGridViewScrollPositionMiddle, + GMGridViewScrollPositionBottom } GMGridViewScrollPosition; typedef enum @@ -121,7 +122,7 @@ typedef enum @protocol GMGridViewDataSource @required -// Populating subview items +// Populating subview items - (NSInteger)numberOfItemsInGMGridView:(GMGridView *)gridView; - (CGSize)GMGridView:(GMGridView *)gridView sizeForItemsInInterfaceOrientation:(UIInterfaceOrientation)orientation; - (GMGridViewCell *)GMGridView:(GMGridView *)gridView cellForItemAtIndex:(NSInteger)index; @@ -167,10 +168,11 @@ typedef enum @optional // Sorting started/ended - indexes are not specified on purpose (not the right place to update data structure) -- (void)GMGridView:(GMGridView *)gridView didStartMovingCell:(GMGridViewCell *)cell; -- (void)GMGridView:(GMGridView *)gridView didEndMovingCell:(GMGridViewCell *)cell; +- (void)GMGridView:(GMGridView *)gridView didStartMovingCell:(GMGridViewCell *)cell atIndex:(NSInteger)index; +- (void)GMGridView:(GMGridView *)gridView didEndMovingCell:(GMGridViewCell *)cell atIndex:(NSInteger)index; // Enable/Disable the shaking behavior of an item being moved - (BOOL)GMGridView:(GMGridView *)gridView shouldAllowShakingBehaviorWhenMovingCell:(GMGridViewCell *)view atIndex:(NSInteger)index; +- (BOOL)GMGridView:(GMGridView *)gridView shouldAllowMovingCell:(GMGridViewCell *)view atIndex:(NSInteger)index; @end diff --git a/GMGridView/GMGridView.m b/GMGridView/GMGridView.m index c362c29..a75ad96 100644 --- a/GMGridView/GMGridView.m +++ b/GMGridView/GMGridView.m @@ -13,10 +13,10 @@ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -30,7 +30,6 @@ #import "GMGridView.h" #import "GMGridViewCell+Extended.h" #import "GMGridViewLayoutStrategies.h" -#import "UIGestureRecognizer+GMGridViewAdditions.h" static const NSInteger kTagOffset = 50; static const CGFloat kDefaultAnimationDuration = 0.3; @@ -162,9 +161,9 @@ - (id)init return [self initWithFrame:CGRectZero]; } -- (id)initWithFrame:(CGRect)frame +- (id)initWithFrame:(CGRect)frame { - if ((self = [super initWithFrame:frame])) + if ((self = [super initWithFrame:frame])) { [self commonInit]; } @@ -173,7 +172,7 @@ - (id)initWithFrame:(CGRect)frame - (id)initWithCoder:(NSCoder *)aDecoder { - if ((self = [super initWithCoder:aDecoder])) + if ((self = [super initWithCoder:aDecoder])) { [self commonInit]; } @@ -223,14 +222,14 @@ - (void)commonInit // Gesture dependencies UIPanGestureRecognizer *panGestureRecognizer = nil; if ([self respondsToSelector:@selector(panGestureRecognizer)]) // iOS5 only - { + { panGestureRecognizer = self.panGestureRecognizer; } - else + else { - for (UIGestureRecognizer *gestureRecognizer in self.gestureRecognizers) - { - if ([gestureRecognizer isKindOfClass:NSClassFromString(@"UIScrollViewPanGestureRecognizer")]) + for (UIGestureRecognizer *gestureRecognizer in self.gestureRecognizers) + { + if ([gestureRecognizer isKindOfClass:NSClassFromString(@"UIScrollViewPanGestureRecognizer")]) { panGestureRecognizer = (UIPanGestureRecognizer *) gestureRecognizer; } @@ -276,9 +275,9 @@ - (void)dealloc #pragma mark Layout ////////////////////////////////////////////////////////////// -- (void)applyWithoutAnimation:(void (^)(void))animations +- (void)applyWithoutAnimation:(void (^)(void))animations { - if (animations) + if (animations) { [CATransaction begin]; [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions]; @@ -294,25 +293,25 @@ - (void)layoutSubviewsWithAnimation:(GMGridViewItemAnimation)animation [self loadRequiredItems]; } -- (void)layoutSubviews +- (void)layoutSubviews { [super layoutSubviews]; - if (_rotationActive) + if (_rotationActive) { - _rotationActive = NO; + _rotationActive = NO; // Updating all the items size CGSize itemSize = [self.dataSource GMGridView:self sizeForItemsInInterfaceOrientation:[[UIApplication sharedApplication] statusBarOrientation]]; - if (!CGSizeEqualToSize(_itemSize, itemSize)) + if (!CGSizeEqualToSize(_itemSize, itemSize)) { _itemSize = itemSize; [[self itemSubviews] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - if (obj != _transformingItem) + if (obj != _transformingItem) { GMGridViewCell *cell = (GMGridViewCell *)obj; cell.bounds = CGRectMake(0, 0, _itemSize.width, _itemSize.height); @@ -323,12 +322,12 @@ - (void)layoutSubviews // Updating the fullview size - if (_transformingItem && _inFullSizeMode) + if (_transformingItem && _inFullSizeMode) { NSInteger position = _transformingItem.tag - kTagOffset; CGSize fullSize = [self.transformDelegate GMGridView:self sizeInFullSizeForCell:_transformingItem atIndex:position inInterfaceOrientation:[[UIApplication sharedApplication] statusBarOrientation]]; - if (!CGSizeEqualToSize(fullSize, _transformingItem.fullSize)) + if (!CGSizeEqualToSize(fullSize, _transformingItem.fullSize)) { CGPoint center = _transformingItem.fullSizeView.center; _transformingItem.fullSize = fullSize; @@ -350,12 +349,12 @@ - (void)layoutSubviews // Fixing the contentOffset when pagging enabled - if (self.pagingEnabled) + if (self.pagingEnabled) { [self setContentOffset:[self rectForPoint:self.contentOffset inPaggingMode:YES].origin animated:YES]; } } - else + else { [self layoutSubviewsWithAnimation:GMGridViewItemAnimationNone]; } @@ -430,7 +429,7 @@ - (CFTimeInterval)minimumPressDuration - (void)setEditing:(BOOL)editing { [self setEditing:editing animated:NO]; - + if ([self.actionDelegate respondsToSelector:@selector(GMGridView:changedEdit:)]) { [self.actionDelegate GMGridView:self changedEdit:editing]; } @@ -439,10 +438,10 @@ - (void)setEditing:(BOOL)editing - (void)setEditing:(BOOL)editing animated:(BOOL)animated { if ([self.actionDelegate respondsToSelector:@selector(GMGridView:processDeleteActionForItemAtIndex:)] - &&![self isInTransformingState] - && ((self.isEditing && !editing) || (!self.isEditing && editing))) + &&![self isInTransformingState] + && ((self.isEditing && !editing) || (!self.isEditing && editing))) { - for (GMGridViewCell *cell in [self itemSubviews]) + for (GMGridViewCell *cell in [self itemSubviews]) { NSInteger index = [self positionForItemSubview:cell]; if (index != GMGV_INVALID_POSITION) @@ -465,8 +464,8 @@ - (void)contentOffset:(CGPoint)contentOffset BOOL valueChanged = !CGPointEqualToPoint(contentOffset, self.contentOffset); [super setContentOffset:contentOffset]; - - if (valueChanged) + + if (valueChanged) { [self loadRequiredItems]; } @@ -483,11 +482,11 @@ - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecogni } - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer -{ +{ BOOL valid = YES; BOOL isScrolling = self.isDragging || self.isDecelerating; - if (gestureRecognizer == _tapGesture) + if (gestureRecognizer == _tapGesture) { if (self.editing && self.disableEditOnEmptySpaceTap) { CGPoint locationTouch = [_tapGesture locationInView:self]; @@ -502,13 +501,13 @@ - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer { valid = (self.sortingDelegate || self.enableEditOnLongPress) && !isScrolling && !self.isEditing; } - else if (gestureRecognizer == _sortingPanGesture) + else if (gestureRecognizer == _sortingPanGesture) { valid = (_sortMovingItem != nil && [_longPressGesture hasRecognizedValidGesture]); } else if(gestureRecognizer == _rotationGesture || gestureRecognizer == _pinchGesture || gestureRecognizer == _panGesture) { - if (self.transformDelegate != nil && [gestureRecognizer numberOfTouches] == 2) + if (self.transformDelegate != nil && [gestureRecognizer numberOfTouches] == 2) { CGPoint locationTouch1 = [gestureRecognizer locationOfTouch:0 inView:self]; CGPoint locationTouch2 = [gestureRecognizer locationOfTouch:1 inView:self]; @@ -537,7 +536,7 @@ - (void)longPressGestureUpdated:(UILongPressGestureRecognizer *)longPressGesture CGPoint locationTouch = [longPressGesture locationInView:self]; NSInteger position = [self.layoutStrategy itemPositionFromLocation:locationTouch]; - if (position != GMGV_INVALID_POSITION) + if (position != GMGV_INVALID_POSITION) { if (!self.editing) { self.editing = YES; @@ -546,17 +545,17 @@ - (void)longPressGestureUpdated:(UILongPressGestureRecognizer *)longPressGesture return; } - switch (longPressGesture.state) + switch (longPressGesture.state) { case UIGestureRecognizerStateBegan: { - if (!_sortMovingItem) - { + if (!_sortMovingItem) + { CGPoint location = [longPressGesture locationInView:self]; NSInteger position = [self.layoutStrategy itemPositionFromLocation:location]; - if (position != GMGV_INVALID_POSITION) + if (position != GMGV_INVALID_POSITION) { [self sortingMoveDidStartAtPoint:location]; } @@ -570,8 +569,8 @@ - (void)longPressGestureUpdated:(UILongPressGestureRecognizer *)longPressGesture { [_sortingPanGesture end]; - if (_sortMovingItem) - { + if (_sortMovingItem) + { CGPoint location = [longPressGesture locationInView:self]; [self sortingMoveDidStopAtPoint:location]; } @@ -585,7 +584,7 @@ - (void)longPressGestureUpdated:(UILongPressGestureRecognizer *)longPressGesture - (void)sortingPanGestureUpdated:(UIPanGestureRecognizer *)panGesture { - switch (panGesture.state) + switch (panGesture.state) { case UIGestureRecognizerStateEnded: case UIGestureRecognizerStateCancelled: @@ -595,7 +594,7 @@ - (void)sortingPanGestureUpdated:(UIPanGestureRecognizer *)panGesture break; } case UIGestureRecognizerStateBegan: - { + { _autoScrollActive = YES; [self sortingAutoScrollMovementCheck]; @@ -619,12 +618,12 @@ - (void)sortingPanGestureUpdated:(UIPanGestureRecognizer *)panGesture - (void)sortingAutoScrollMovementCheck { - if (_sortMovingItem && _autoScrollActive) + if (_sortMovingItem && _autoScrollActive) { CGPoint locationInMainView = [_sortingPanGesture locationInView:self]; locationInMainView = CGPointMake(locationInMainView.x - self.contentOffset.x, locationInMainView.y -self.contentOffset.y - ); + ); CGFloat threshhold = _itemSize.height; @@ -632,50 +631,50 @@ - (void)sortingAutoScrollMovementCheck CGPoint locationInScroll = [_sortingPanGesture locationInView:self]; // Going down - if (locationInMainView.x + threshhold > self.bounds.size.width) - { + if (locationInMainView.x + threshhold > self.bounds.size.width) + { offset.x += _itemSize.width / 2; - if (offset.x > _maxPossibleContentOffset.x) + if (offset.x > _maxPossibleContentOffset.x) { offset.x = _maxPossibleContentOffset.x; } } // Going up - else if (locationInMainView.x - threshhold <= 0) - { + else if (locationInMainView.x - threshhold <= 0) + { offset.x -= _itemSize.width / 2; - if (offset.x < _minPossibleContentOffset.x) + if (offset.x < _minPossibleContentOffset.x) { offset.x = _minPossibleContentOffset.x; } } // Going right - if (locationInMainView.y + threshhold > self.bounds.size.height) - { + if (locationInMainView.y + threshhold > self.bounds.size.height) + { offset.y += _itemSize.height / 2; - if (offset.y > _maxPossibleContentOffset.y) + if (offset.y > _maxPossibleContentOffset.y) { offset.y = _maxPossibleContentOffset.y; } } // Going left - else if (locationInMainView.y - threshhold <= 0) - { + else if (locationInMainView.y - threshhold <= 0) + { offset.y -= _itemSize.height / 2; - if (offset.y < _minPossibleContentOffset.y) + if (offset.y < _minPossibleContentOffset.y) { offset.y = _minPossibleContentOffset.y; } } - if (offset.x != self.contentOffset.x || offset.y != self.contentOffset.y) + if (offset.x != self.contentOffset.x || offset.y != self.contentOffset.y) { - [UIView animateWithDuration:kDefaultAnimationDuration + [UIView animateWithDuration:kDefaultAnimationDuration delay:0 options:kDefaultAnimationOptions animations:^{ @@ -685,7 +684,7 @@ - (void)sortingAutoScrollMovementCheck self.contentOffset = offset; - if (_autoScrollActive) + if (_autoScrollActive) { [self sortingMoveDidContinueToPoint:locationInScroll]; } @@ -704,38 +703,46 @@ - (void)sortingAutoScrollMovementCheck - (void)sortingMoveDidStartAtPoint:(CGPoint)point { NSInteger position = [self.layoutStrategy itemPositionFromLocation:point]; - GMGridViewCell *item = [self cellForItemAtIndex:position]; - [self bringSubviewToFront:item]; - _sortMovingItem = item; - - CGRect frameInMainView = [self convertRect:_sortMovingItem.frame toView:self.mainSuperView]; - - [_sortMovingItem removeFromSuperview]; - _sortMovingItem.frame = frameInMainView; - [self.mainSuperView addSubview:_sortMovingItem]; - - _sortFuturePosition = _sortMovingItem.tag - kTagOffset; - _sortMovingItem.tag = 0; - - if ([self.sortingDelegate respondsToSelector:@selector(GMGridView:didStartMovingCell:)]) + if([self.sortingDelegate respondsToSelector:@selector(GMGridView:shouldAllowMovingCell:atIndex:)]) { - [self.sortingDelegate GMGridView:self didStartMovingCell:_sortMovingItem]; - } - - if ([self.sortingDelegate respondsToSelector:@selector(GMGridView:shouldAllowShakingBehaviorWhenMovingCell:atIndex:)]) - { - [_sortMovingItem shake:[self.sortingDelegate GMGridView:self shouldAllowShakingBehaviorWhenMovingCell:_sortMovingItem atIndex:position]]; - } - else - { - [_sortMovingItem shake:YES]; + if([self.sortingDelegate GMGridView:self shouldAllowMovingCell:item atIndex:position]) + { + + [self bringSubviewToFront:item]; + _sortMovingItem = item; + + CGRect frameInMainView = [self convertRect:_sortMovingItem.frame toView:self.mainSuperView]; + + [_sortMovingItem removeFromSuperview]; + _sortMovingItem.frame = frameInMainView; + [self.mainSuperView addSubview:_sortMovingItem]; + + _sortFuturePosition = _sortMovingItem.tag - kTagOffset; + _sortMovingItem.tag = 0; + + if ([self.sortingDelegate respondsToSelector:@selector(GMGridView:didStartMovingCell:atIndex:)]) + { + [self.sortingDelegate GMGridView:self didStartMovingCell:_sortMovingItem atIndex:position]; + } + + if ([self.sortingDelegate respondsToSelector:@selector(GMGridView:shouldAllowShakingBehaviorWhenMovingCell:atIndex:)]) + { + [_sortMovingItem shake:[self.sortingDelegate GMGridView:self shouldAllowShakingBehaviorWhenMovingCell:_sortMovingItem atIndex:position]]; + } + else + { + [_sortMovingItem shake:YES]; + } + } } } - (void)sortingMoveDidStopAtPoint:(CGPoint)point { + NSInteger position = [self.layoutStrategy itemPositionFromLocation:point]; + [_sortMovingItem shake:NO]; _sortMovingItem.tag = _sortFuturePosition + kTagOffset; @@ -749,7 +756,7 @@ - (void)sortingMoveDidStopAtPoint:(CGPoint)point CGPoint newOrigin = [self.layoutStrategy originForItemAtPosition:_sortFuturePosition]; CGRect newFrame = CGRectMake(newOrigin.x, newOrigin.y, _itemSize.width, _itemSize.height); - [UIView animateWithDuration:kDefaultAnimationDuration + [UIView animateWithDuration:kDefaultAnimationDuration delay:0 options:0 animations:^{ @@ -757,9 +764,9 @@ - (void)sortingMoveDidStopAtPoint:(CGPoint)point _sortMovingItem.frame = newFrame; } completion:^(BOOL finished){ - if ([self.sortingDelegate respondsToSelector:@selector(GMGridView:didEndMovingCell:)]) + if ([self.sortingDelegate respondsToSelector:@selector(GMGridView:didEndMovingCell:atIndex:)]) { - [self.sortingDelegate GMGridView:self didEndMovingCell:_sortMovingItem]; + [self.sortingDelegate GMGridView:self didEndMovingCell:_sortMovingItem atIndex:position]; } _sortMovingItem = nil; @@ -772,84 +779,94 @@ - (void)sortingMoveDidStopAtPoint:(CGPoint)point - (void)sortingMoveDidContinueToPoint:(CGPoint)point { - int position = [self.layoutStrategy itemPositionFromLocation:point]; - int tag = position + kTagOffset; + NSInteger position = [self.layoutStrategy itemPositionFromLocation:point]; + GMGridViewCell *item = [self cellForItemAtIndex:position]; - if (position != GMGV_INVALID_POSITION && position != _sortFuturePosition && position < _numberTotalItems) + if([self.sortingDelegate respondsToSelector:@selector(GMGridView:shouldAllowMovingCell:atIndex:)]) { - BOOL positionTaken = NO; - - for (UIView *v in [self itemSubviews]) - { - if (v != _sortMovingItem && v.tag == tag) - { - positionTaken = YES; - break; - } - } - - if (positionTaken) + if([self.sortingDelegate GMGridView:self shouldAllowMovingCell:item atIndex:position]) { - switch (self.style) + + + NSInteger tag = position + kTagOffset; + + if (position != GMGV_INVALID_POSITION && position != _sortFuturePosition && position < _numberTotalItems) { - case GMGridViewStylePush: + BOOL positionTaken = NO; + + for (UIView *v in [self itemSubviews]) + { + if (v != _sortMovingItem && v.tag == tag) + { + positionTaken = YES; + break; + } + } + + if (positionTaken) { - if (position > _sortFuturePosition) + switch (self.style) { - for (UIView *v in [self itemSubviews]) + case GMGridViewStylePush: { - if ((v.tag == tag || (v.tag < tag && v.tag >= _sortFuturePosition + kTagOffset)) && v != _sortMovingItem ) + if (position > _sortFuturePosition) { - v.tag = v.tag - 1; - [self sendSubviewToBack:v]; + for (UIView *v in [self itemSubviews]) + { + if ((v.tag == tag || (v.tag < tag && v.tag >= _sortFuturePosition + kTagOffset)) && v != _sortMovingItem ) + { + v.tag = v.tag - 1; + [self sendSubviewToBack:v]; + } + } } + else + { + for (UIView *v in [self itemSubviews]) + { + if ((v.tag == tag || (v.tag > tag && v.tag <= _sortFuturePosition + kTagOffset)) && v != _sortMovingItem) + { + v.tag = v.tag + 1; + [self sendSubviewToBack:v]; + } + } + } + + [self.sortingDelegate GMGridView:self moveItemAtIndex:_sortFuturePosition toIndex:position]; + [self relayoutItemsAnimated:YES]; + + break; } - } - else - { - for (UIView *v in [self itemSubviews]) + case GMGridViewStyleSwap: + default: { - if ((v.tag == tag || (v.tag > tag && v.tag <= _sortFuturePosition + kTagOffset)) && v != _sortMovingItem) + if (_sortMovingItem) { - v.tag = v.tag + 1; - [self sendSubviewToBack:v]; + UIView *v = [self cellForItemAtIndex:position]; + + v.tag = _sortFuturePosition + kTagOffset; + CGPoint origin = [self.layoutStrategy originForItemAtPosition:_sortFuturePosition]; + + [UIView animateWithDuration:kDefaultAnimationDuration + delay:0 + options:kDefaultAnimationOptions + animations:^{ + v.frame = CGRectMake(origin.x, origin.y, _itemSize.width, _itemSize.height); + } + completion:nil + ]; } + + [self.sortingDelegate GMGridView:self exchangeItemAtIndex:_sortFuturePosition withItemAtIndex:position]; + + break; } } - - [self.sortingDelegate GMGridView:self moveItemAtIndex:_sortFuturePosition toIndex:position]; - [self relayoutItemsAnimated:YES]; - - break; - } - case GMGridViewStyleSwap: - default: - { - if (_sortMovingItem) - { - UIView *v = [self cellForItemAtIndex:position]; - - v.tag = _sortFuturePosition + kTagOffset; - CGPoint origin = [self.layoutStrategy originForItemAtPosition:_sortFuturePosition]; - - [UIView animateWithDuration:kDefaultAnimationDuration - delay:0 - options:kDefaultAnimationOptions - animations:^{ - v.frame = CGRectMake(origin.x, origin.y, _itemSize.width, _itemSize.height); - } - completion:nil - ]; - } - - [self.sortingDelegate GMGridView:self exchangeItemAtIndex:_sortFuturePosition withItemAtIndex:position]; - - break; } + + _sortFuturePosition = position; } } - - _sortFuturePosition = position; } } @@ -859,7 +876,7 @@ - (void)sortingMoveDidContinueToPoint:(CGPoint)point - (void)panGestureUpdated:(UIPanGestureRecognizer *)panGesture { - switch (panGesture.state) + switch (panGesture.state) { case UIGestureRecognizerStateEnded: case UIGestureRecognizerStateCancelled: @@ -881,7 +898,7 @@ - (void)panGestureUpdated:(UIPanGestureRecognizer *)panGesture } case UIGestureRecognizerStateChanged: { - if (panGesture.numberOfTouches != 2) + if (panGesture.numberOfTouches != 2) { [panGesture end]; } @@ -900,7 +917,7 @@ - (void)panGestureUpdated:(UIPanGestureRecognizer *)panGesture - (void)pinchGestureUpdated:(UIPinchGestureRecognizer *)pinchGesture { - switch (pinchGesture.state) + switch (pinchGesture.state) { case UIGestureRecognizerStateEnded: case UIGestureRecognizerStateCancelled: @@ -928,7 +945,7 @@ - (void)pinchGestureUpdated:(UIPinchGestureRecognizer *)pinchGesture scale = MIN(scale, kMaxScale / currentScale); scale = MAX(scale, kMinScale / currentScale); - if (scale >= kMinScale && scale <= kMaxScale) + if (scale >= kMinScale && scale <= kMaxScale) { CGAffineTransform currentTransform = [_transformingItem.contentView transform]; CGAffineTransform newTransform = CGAffineTransformScale(currentTransform, scale, scale); @@ -942,7 +959,7 @@ - (void)pinchGestureUpdated:(UIPinchGestureRecognizer *)pinchGesture alpha = MAX(0, alpha); alpha = MIN(1, alpha); - if (self.showFullSizeViewWithAlphaWhenTransforming && currentScale >= 1.5) + if (self.showFullSizeViewWithAlphaWhenTransforming && currentScale >= 1.5) { [_transformingItem stepToFullsizeWithAlpha:alpha]; } @@ -960,7 +977,7 @@ - (void)pinchGestureUpdated:(UIPinchGestureRecognizer *)pinchGesture - (void)rotationGestureUpdated:(UIRotationGestureRecognizer *)rotationGesture { - switch (rotationGesture.state) + switch (rotationGesture.state) { case UIGestureRecognizerStateEnded: case UIGestureRecognizerStateCancelled: @@ -996,13 +1013,13 @@ - (void)transformingGestureDidBeginWithGesture:(UIGestureRecognizer *)gesture { _inFullSizeMode = NO; - if (_inTransformingState && [gesture isKindOfClass:[UIPinchGestureRecognizer class]]) + if (_inTransformingState && [gesture isKindOfClass:[UIPinchGestureRecognizer class]]) { _pinchGesture.scale = 2.5; } if (_inTransformingState) - { + { _inTransformingState = NO; CGPoint center = _transformingItem.fullSizeView.center; @@ -1012,9 +1029,9 @@ - (void)transformingGestureDidBeginWithGesture:(UIGestureRecognizer *)gesture _transformingItem.contentView.transform = newTransform; _transformingItem.contentView.center = center; } - else if (!_transformingItem) - { - CGPoint locationTouch = [gesture locationOfTouch:0 inView:self]; + else if (!_transformingItem) + { + CGPoint locationTouch = [gesture locationOfTouch:0 inView:self]; NSInteger positionTouch = [self.layoutStrategy itemPositionFromLocation:locationTouch]; _transformingItem = [self cellForItemAtIndex:positionTouch]; @@ -1030,7 +1047,7 @@ - (void)transformingGestureDidBeginWithGesture:(UIGestureRecognizer *)gesture _transformingItem.fullSize = [self.transformDelegate GMGridView:self sizeInFullSizeForCell:_transformingItem atIndex:positionTouch inInterfaceOrientation:[[UIApplication sharedApplication] statusBarOrientation]]; _transformingItem.fullSizeView = [self.transformDelegate GMGridView:self fullSizeViewForCell:_transformingItem atIndex:positionTouch]; - if ([self.transformDelegate respondsToSelector:@selector(GMGridView:didStartTransformingCell:)]) + if ([self.transformDelegate respondsToSelector:@selector(GMGridView:didStartTransformingCell:)]) { [self.transformDelegate GMGridView:self didStartTransformingCell:_transformingItem]; } @@ -1044,16 +1061,16 @@ - (BOOL)isInTransformingState - (void)transformingGestureDidFinish { - if ([self isInTransformingState]) + if ([self isInTransformingState]) { - if (_lastScale > 2 && !_inTransformingState) - { + if (_lastScale > 2 && !_inTransformingState) + { _lastRotation = 0; _lastScale = 1; [self bringSubviewToFront:_transformingItem]; - CGFloat rotationValue = atan2f(_transformingItem.contentView.transform.b, _transformingItem.contentView.transform.a); + CGFloat rotationValue = atan2f(_transformingItem.contentView.transform.b, _transformingItem.contentView.transform.a); _transformingItem.contentView.transform = CGAffineTransformIdentity; @@ -1062,7 +1079,7 @@ - (void)transformingGestureDidFinish _transformingItem.fullSizeView.transform = CGAffineTransformMakeRotation(rotationValue); - [UIView animateWithDuration:kDefaultAnimationDuration + [UIView animateWithDuration:kDefaultAnimationDuration delay:0 options:kDefaultAnimationOptions animations:^{ @@ -1108,7 +1125,7 @@ - (void)transformingGestureDidFinish transformingView.contentView.transform = CGAffineTransformIdentity; transformingView.contentView.frame = finalFrameInSuperview; transformingView.backgroundColor = [UIColor clearColor]; - } + } completion:^(BOOL finished){ [transformingView removeFromSuperview]; @@ -1143,7 +1160,7 @@ - (void)tapGestureUpdated:(UITapGestureRecognizer *)tapGesture CGPoint locationTouch = [_tapGesture locationInView:self]; NSInteger position = [self.layoutStrategy itemPositionFromLocation:locationTouch]; - if (position != GMGV_INVALID_POSITION) + if (position != GMGV_INVALID_POSITION) { if (!self.editing) { [self cellForItemAtIndex:position].highlighted = NO; @@ -1151,7 +1168,7 @@ - (void)tapGestureUpdated:(UITapGestureRecognizer *)tapGesture } } else - { + { if([self.actionDelegate respondsToSelector:@selector(GMGridViewDidTapOnEmptySpace:)]) { [self.actionDelegate GMGridViewDidTapOnEmptySpace:self]; @@ -1183,24 +1200,24 @@ - (GMGridViewCell *)newItemSubViewForPosition:(NSInteger)position cell.frame = frame; cell.contentView.frame = cell.bounds; }]; - + cell.tag = position + kTagOffset; BOOL canEdit = self.editing && [self.dataSource GMGridView:self canDeleteItemAtIndex:position]; [cell setEditing:canEdit animated:NO]; - __gm_weak GMGridView *weakSelf = self; + __gm_weak GMGridView *weakSelf = self; cell.deleteBlock = ^(GMGridViewCell *aCell) { NSInteger index = [weakSelf positionForItemSubview:aCell]; - if (index != GMGV_INVALID_POSITION) + if (index != GMGV_INVALID_POSITION) { BOOL canDelete = YES; - if ([weakSelf.dataSource respondsToSelector:@selector(GMGridView:canDeleteItemAtIndex:)]) + if ([weakSelf.dataSource respondsToSelector:@selector(GMGridView:canDeleteItemAtIndex:)]) { canDelete = [weakSelf.dataSource GMGridView:weakSelf canDeleteItemAtIndex:index]; } - if (canDelete && [weakSelf.actionDelegate respondsToSelector:@selector(GMGridView:processDeleteActionForItemAtIndex:)]) + if (canDelete && [weakSelf.actionDelegate respondsToSelector:@selector(GMGridView:processDeleteActionForItemAtIndex:)]) { [weakSelf.actionDelegate GMGridView:weakSelf processDeleteActionForItemAtIndex:index]; } @@ -1214,7 +1231,7 @@ - (NSArray *)itemSubviews { NSArray *subviews = nil; - if (self.itemsSubviewsCacheIsValid) + if (self.itemsSubviewsCacheIsValid) { subviews = [self.itemSubviewsCache copy]; } @@ -1224,9 +1241,9 @@ - (NSArray *)itemSubviews { NSMutableArray *itemSubViews = [[NSMutableArray alloc] initWithCapacity:_numberTotalItems]; - for (UIView * v in [self subviews]) + for (UIView * v in [self subviews]) { - if ([v isKindOfClass:[GMGridViewCell class]]) + if ([v isKindOfClass:[GMGridViewCell class]]) { [itemSubViews addObject:v]; } @@ -1246,9 +1263,9 @@ - (GMGridViewCell *)cellForItemAtIndex:(NSInteger)position { GMGridViewCell *view = nil; - for (GMGridViewCell *v in [self itemSubviews]) + for (GMGridViewCell *v in [self itemSubviews]) { - if (v.tag == position + kTagOffset) + if (v.tag == position + kTagOffset) { view = v; break; @@ -1271,7 +1288,7 @@ - (void)recomputeSizeAnimated:(BOOL)animated CGSize contentSize = [self.layoutStrategy contentSize]; _minPossibleContentOffset = CGPointMake(0, 0); - _maxPossibleContentOffset = CGPointMake(contentSize.width - self.bounds.size.width + self.contentInset.right, + _maxPossibleContentOffset = CGPointMake(contentSize.width - self.bounds.size.width + self.contentInset.right, contentSize.height - self.bounds.size.height + self.contentInset.bottom); BOOL shouldUpdateScrollviewContentSize = !CGSizeEqualToSize(self.contentSize, contentSize); @@ -1281,8 +1298,8 @@ - (void)recomputeSizeAnimated:(BOOL)animated if (animated) { [UIView animateWithDuration:kDefaultAnimationDuration - delay:0 - options:kDefaultAnimationOptions + delay:0 + options:kDefaultAnimationOptions animations:^{ self.contentSize = contentSize; } @@ -1297,18 +1314,18 @@ - (void)recomputeSizeAnimated:(BOOL)animated } - (void)relayoutItemsAnimated:(BOOL)animated -{ +{ void (^layoutBlock)(void) = ^{ for (UIView *view in [self itemSubviews]) - { - if (view != _sortMovingItem && view != _transformingItem) + { + if (view != _sortMovingItem && view != _transformingItem) { NSInteger index = view.tag - kTagOffset; CGPoint origin = [self.layoutStrategy originForItemAtPosition:index]; CGRect newFrame = CGRectMake(origin.x, origin.y, _itemSize.width, _itemSize.height); // IF statement added for performance reasons (Time Profiling in instruments) - if (!CGRectEqualToRect(newFrame, view.frame)) + if (!CGRectEqualToRect(newFrame, view.frame)) { view.frame = newFrame; } @@ -1316,9 +1333,9 @@ - (void)relayoutItemsAnimated:(BOOL)animated } }; - if (animated) + if (animated) { - [UIView animateWithDuration:kDefaultAnimationDuration + [UIView animateWithDuration:kDefaultAnimationDuration delay:0 options:kDefaultAnimationOptions animations:^{ @@ -1327,7 +1344,7 @@ - (void)relayoutItemsAnimated:(BOOL)animated completion:nil ]; } - else + else { layoutBlock(); } @@ -1337,33 +1354,33 @@ - (CGRect)rectForPoint:(CGPoint)point inPaggingMode:(BOOL)pagging { CGRect targetRect = CGRectZero; - if (self.pagingEnabled) + if (self.pagingEnabled) { CGPoint originScroll = CGPointZero; - CGSize pageSize = CGSizeMake(self.bounds.size.width - self.contentInset.left - self.contentInset.right, - self.bounds.size.height - self.contentInset.top - self.contentInset.bottom); + CGSize pageSize = CGSizeMake(self.bounds.size.width - self.contentInset.left - self.contentInset.right, + self.bounds.size.height - self.contentInset.top - self.contentInset.bottom); CGFloat pageX = ceilf(point.x / pageSize.width); CGFloat pageY = ceilf(point.y / pageSize.height); - originScroll = CGPointMake(pageX * pageSize.width, + originScroll = CGPointMake(pageX * pageSize.width, pageY *pageSize.height); /* - while (originScroll.x + pageSize.width < point.x) - { - originScroll.x += pageSize.width; - } - - while (originScroll.y + pageSize.height < point.y) - { - originScroll.y += pageSize.height; - } - */ + while (originScroll.x + pageSize.width < point.x) + { + originScroll.x += pageSize.width; + } + + while (originScroll.y + pageSize.height < point.y) + { + originScroll.y += pageSize.height; + } + */ targetRect = CGRectMake(originScroll.x, originScroll.y, pageSize.width, pageSize.height); } - else + else { targetRect = CGRectMake(point.x, point.y, _itemSize.width, _itemSize.height); } @@ -1379,7 +1396,7 @@ - (void)loadRequiredItems { NSRange rangeOfPositions = [self.layoutStrategy rangeOfPositionsInBoundsFromOffset: self.contentOffset]; NSRange loadedPositionsRange = NSMakeRange(self.firstPositionLoaded, self.lastPositionLoaded - self.firstPositionLoaded); - + // calculate new position range self.firstPositionLoaded = self.firstPositionLoaded == GMGV_INVALID_POSITION ? rangeOfPositions.location : MIN(self.firstPositionLoaded, (NSInteger)rangeOfPositions.location); self.lastPositionLoaded = self.lastPositionLoaded == GMGV_INVALID_POSITION ? NSMaxRange(rangeOfPositions) : MAX(self.lastPositionLoaded, (NSInteger)(rangeOfPositions.length + rangeOfPositions.location)); @@ -1391,19 +1408,19 @@ - (void)loadRequiredItems // add new cells BOOL forceLoad = self.firstPositionLoaded == GMGV_INVALID_POSITION || self.lastPositionLoaded == GMGV_INVALID_POSITION; NSInteger positionToLoad; - for (NSUInteger i = 0; i < rangeOfPositions.length; i++) + for (NSUInteger i = 0; i < rangeOfPositions.length; i++) { positionToLoad = i + rangeOfPositions.location; - if ((forceLoad || !NSLocationInRange(positionToLoad, loadedPositionsRange)) && positionToLoad < _numberTotalItems) + if ((forceLoad || !NSLocationInRange(positionToLoad, loadedPositionsRange)) && positionToLoad < _numberTotalItems) { - if (![self cellForItemAtIndex:positionToLoad]) + if (![self cellForItemAtIndex:positionToLoad]) { GMGridViewCell *cell = [self newItemSubViewForPosition:positionToLoad]; [self addSubview:cell]; } } - } + } } @@ -1412,9 +1429,9 @@ - (void)cleanupUnseenItems NSRange rangeOfPositions = [self.layoutStrategy rangeOfPositionsInBoundsFromOffset: self.contentOffset]; GMGridViewCell *cell; - if ((NSInteger)rangeOfPositions.location > self.firstPositionLoaded) + if ((NSInteger)rangeOfPositions.location > self.firstPositionLoaded) { - for (NSInteger i = self.firstPositionLoaded; i < (NSInteger)rangeOfPositions.location; i++) + for (NSInteger i = self.firstPositionLoaded; i < (NSInteger)rangeOfPositions.location; i++) { cell = [self cellForItemAtIndex:i]; if(cell) @@ -1428,7 +1445,7 @@ - (void)cleanupUnseenItems [self setSubviewsCacheAsInvalid]; } - if ((NSInteger)NSMaxRange(rangeOfPositions) < self.lastPositionLoaded) + if ((NSInteger)NSMaxRange(rangeOfPositions) < self.lastPositionLoaded) { for (NSInteger i = NSMaxRange(rangeOfPositions); i <= self.lastPositionLoaded; i++) { @@ -1447,7 +1464,7 @@ - (void)cleanupUnseenItems - (void)queueReusableCell:(GMGridViewCell *)cell { - if (cell) + if (cell) { [cell prepareForReuse]; cell.alpha = 1; @@ -1460,7 +1477,7 @@ - (GMGridViewCell *)dequeueReusableCell { GMGridViewCell *cell = [_reusableCells anyObject]; - if (cell) + if (cell) { [_reusableCells removeObject:cell]; } @@ -1472,16 +1489,16 @@ - (GMGridViewCell *)dequeueReusableCellWithIdentifier:(NSString *)identifier { GMGridViewCell *cell = nil; - for (GMGridViewCell *reusableCell in [_reusableCells allObjects]) + for (GMGridViewCell *reusableCell in [_reusableCells allObjects]) { - if ([reusableCell.reuseIdentifier isEqualToString:identifier]) + if ([reusableCell.reuseIdentifier isEqualToString:identifier]) { cell = reusableCell; break; } } - if (cell) + if (cell) { [_reusableCells removeObject:cell]; } @@ -1498,20 +1515,20 @@ - (void)reloadData CGPoint previousContentOffset = self.contentOffset; [[self itemSubviews] enumerateObjectsUsingBlock:^(id obj, NSUInteger index, BOOL *stop) - { - if ([obj isKindOfClass:[GMGridViewCell class]]) - { - [(UIView *)obj removeFromSuperview]; - [self queueReusableCell:(GMGridViewCell *)obj]; - } - }]; + { + if ([obj isKindOfClass:[GMGridViewCell class]]) + { + [(UIView *)obj removeFromSuperview]; + [self queueReusableCell:(GMGridViewCell *)obj]; + } + }]; self.firstPositionLoaded = GMGV_INVALID_POSITION; self.lastPositionLoaded = GMGV_INVALID_POSITION; [self setSubviewsCacheAsInvalid]; - NSUInteger numberItems = [self.dataSource numberOfItemsInGMGridView:self]; + NSUInteger numberItems = [self.dataSource numberOfItemsInGMGridView:self]; _itemSize = [self.dataSource GMGridView:self sizeForItemsInInterfaceOrientation:[[UIApplication sharedApplication] statusBarOrientation]]; _numberTotalItems = numberItems; @@ -1534,7 +1551,7 @@ - (void)reloadObjectAtIndex:(NSInteger)index animated:(BOOL)animated } - (void)reloadObjectAtIndex:(NSInteger)index withAnimation:(GMGridViewItemAnimation)animation -{ +{ NSAssert((index >= 0 && index < _numberTotalItems), @"Invalid index"); UIView *currentView = [self cellForItemAtIndex:index]; @@ -1548,7 +1565,7 @@ - (void)reloadObjectAtIndex:(NSInteger)index withAnimation:(GMGridViewItemAnimat currentView.tag = kTagOffset - 1; BOOL shouldScroll = animation & GMGridViewItemAnimationScroll; BOOL animate = animation & GMGridViewItemAnimationFade; - [UIView animateWithDuration:animate ? kDefaultAnimationDuration : 0.f + [UIView animateWithDuration:animate ? kDefaultAnimationDuration : 0.f delay:0.f options:kDefaultAnimationOptions animations:^{ @@ -1557,7 +1574,7 @@ - (void)reloadObjectAtIndex:(NSInteger)index withAnimation:(GMGridViewItemAnimat } currentView.alpha = 0; cell.alpha = 1; - } + } completion:^(BOOL finished){ [currentView removeFromSuperview]; } @@ -1577,14 +1594,14 @@ - (void)scrollToObjectAtIndex:(NSInteger)index atScrollPosition:(GMGridViewScrol if (!self.pagingEnabled) { CGRect gridRect = CGRectMake(origin.x, origin.y, _itemSize.width, _itemSize.height); - + switch (scrollPosition) { case GMGridViewScrollPositionNone: default: targetRect = gridRect; // no special coordinate handling break; - + case GMGridViewScrollPositionTop: targetRect.origin.y = gridRect.origin.y; // set target y origin to cell's y origin break; @@ -1605,7 +1622,7 @@ - (void)scrollToObjectAtIndex:(NSInteger)index atScrollPosition:(GMGridViewScrol options:kDefaultAnimationOptions animations:^{ [self scrollRectToVisible:targetRect animated:NO]; - } + } completion:^(BOOL finished){ } ]; @@ -1622,11 +1639,11 @@ - (void)insertObjectAtIndex:(NSInteger)index withAnimation:(GMGridViewItemAnimat GMGridViewCell *cell = nil; - if (index >= self.firstPositionLoaded && index <= self.lastPositionLoaded) - { + if (index >= self.firstPositionLoaded && index <= self.lastPositionLoaded) + { cell = [self newItemSubViewForPosition:index]; - for (int i = _numberTotalItems - 1; i >= index; i--) + for (NSInteger i = _numberTotalItems - 1; i >= index; i--) { UIView *oldView = [self cellForItemAtIndex:i]; oldView.tag = oldView.tag + 1; @@ -1649,18 +1666,18 @@ - (void)insertObjectAtIndex:(NSInteger)index withAnimation:(GMGridViewItemAnimat BOOL shouldScroll = animation & GMGridViewItemAnimationScroll; if (shouldScroll) { - [UIView animateWithDuration:kDefaultAnimationDuration + [UIView animateWithDuration:kDefaultAnimationDuration delay:0 options:kDefaultAnimationOptions animations:^{ [self scrollToObjectAtIndex:index atScrollPosition:GMGridViewScrollPositionNone animated:NO]; - } + } completion:^(BOOL finished){ [self layoutSubviewsWithAnimation:animation]; } ]; } - else + else { [self layoutSubviewsWithAnimation:animation]; } @@ -1679,7 +1696,7 @@ - (void)removeObjectAtIndex:(NSInteger)index withAnimation:(GMGridViewItemAnimat GMGridViewCell *cell = [self cellForItemAtIndex:index]; - for (int i = index + 1; i < _numberTotalItems; i++) + for (NSInteger i = index + 1; i < _numberTotalItems; i++) { GMGridViewCell *oldView = [self cellForItemAtIndex:i]; oldView.tag = oldView.tag - 1; @@ -1701,7 +1718,7 @@ - (void)removeObjectAtIndex:(NSInteger)index withAnimation:(GMGridViewItemAnimat [self scrollToObjectAtIndex:index atScrollPosition:GMGridViewScrollPositionNone animated:NO]; } [self recomputeSizeAnimated:!(animation & GMGridViewItemAnimationNone)]; - } + } completion:^(BOOL finished) { cell.contentView.alpha = 1.f; [self queueReusableCell:cell]; @@ -1740,27 +1757,27 @@ - (void)swapObjectAtIndex:(NSInteger)index1 withObjectAtIndex:(NSInteger)index2 CGRect visibleRect = CGRectMake(self.contentOffset.x, - self.contentOffset.y, - self.contentSize.width, + self.contentOffset.y, + self.contentSize.width, self.contentSize.height); // Better performance animating ourselves instead of using animated:YES in scrollRectToVisible BOOL shouldScroll = animation & GMGridViewItemAnimationScroll; - [UIView animateWithDuration:kDefaultAnimationDuration + [UIView animateWithDuration:kDefaultAnimationDuration delay:0 options:kDefaultAnimationOptions animations:^{ if (shouldScroll) { - if (!CGRectIntersectsRect(view2.frame, visibleRect)) + if (!CGRectIntersectsRect(view2.frame, visibleRect)) { [self scrollToObjectAtIndex:index1 atScrollPosition:GMGridViewScrollPositionNone animated:NO]; } - else if (!CGRectIntersectsRect(view1.frame, visibleRect)) + else if (!CGRectIntersectsRect(view1.frame, visibleRect)) { [self scrollToObjectAtIndex:index2 atScrollPosition:GMGridViewScrollPositionNone animated:NO]; } } - } + } completion:^(BOOL finished) { [self setNeedsLayout]; }]; diff --git a/GMGridView/GMGridView.xcodeproj/project.pbxproj b/GMGridView/GMGridView.xcodeproj/project.pbxproj index 8758ee9..0754412 100644 --- a/GMGridView/GMGridView.xcodeproj/project.pbxproj +++ b/GMGridView/GMGridView.xcodeproj/project.pbxproj @@ -7,9 +7,9 @@ objects = { /* Begin PBXBuildFile section */ - 16A0361014A012E60062437D /* UIGestureRecognizer+GMGridViewAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 16A0360E14A012E50062437D /* UIGestureRecognizer+GMGridViewAdditions.h */; }; + 16A0361014A012E60062437D /* UIGestureRecognizer+GMGridViewAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 16A0360E14A012E50062437D /* UIGestureRecognizer+GMGridViewAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; 16A0361114A012E60062437D /* UIGestureRecognizer+GMGridViewAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 16A0360F14A012E50062437D /* UIGestureRecognizer+GMGridViewAdditions.m */; }; - 16A0361514A012EF0062437D /* UIView+GMGridViewAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 16A0361314A012EF0062437D /* UIView+GMGridViewAdditions.h */; }; + 16A0361514A012EF0062437D /* UIView+GMGridViewAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 16A0361314A012EF0062437D /* UIView+GMGridViewAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; 16A0361614A012EF0062437D /* UIView+GMGridViewAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 16A0361414A012EF0062437D /* UIView+GMGridViewAdditions.m */; }; 78509316149FAC2E000787E4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 78509315149FAC2E000787E4 /* Foundation.framework */; }; 78509341149FAC61000787E4 /* GMGridView-Constants.h in Headers */ = {isa = PBXBuildFile; fileRef = 78509335149FAC61000787E4 /* GMGridView-Constants.h */; settings = {ATTRIBUTES = (Public, ); }; }; diff --git a/GMGridView/GMGridViewCell.h b/GMGridView/GMGridViewCell.h index c69028d..472895d 100644 --- a/GMGridView/GMGridViewCell.h +++ b/GMGridView/GMGridViewCell.h @@ -13,10 +13,10 @@ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -28,6 +28,7 @@ #import #import "GMGridView-Constants.h" +#import "UIView+GMGridViewAdditions.h" @interface GMGridViewCell : UIView diff --git a/GMGridView/GMGridViewCell.m b/GMGridView/GMGridViewCell.m index 67e5013..78e6344 100644 --- a/GMGridView/GMGridViewCell.m +++ b/GMGridView/GMGridViewCell.m @@ -27,7 +27,6 @@ // #import "GMGridViewCell+Extended.h" -#import "UIView+GMGridViewAdditions.h" ////////////////////////////////////////////////////////////// #pragma mark - Interface Private