Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions AQGridView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 3.0;
OTHER_LDFLAGS = "-ObjC";
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -345,6 +346,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 3.0;
OTHER_LDFLAGS = "-ObjC";
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
12 changes: 2 additions & 10 deletions AQGridView.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 24 additions & 1 deletion Classes/AQGridView.m
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ - (void) deleteVisibleCell: (AQGridViewCell *) cell atIndex: (NSUInteger) visibl

@interface AQGridView ()
@property (nonatomic, copy) NSIndexSet * animatingIndices;
- (void) cellUpdateAnimationStopped: (NSString *) animationID finished: (BOOL) finished context: (void *) context;
- (void) handleGridViewBoundsChanged: (CGRect) oldBounds toNewBounds: (CGRect) bounds;
@end


Expand Down Expand Up @@ -356,6 +358,9 @@ - (void) setGridHeaderView: (UIView *) newHeaderView
[_headerView removeFromSuperview];

_headerView = newHeaderView;

CGFloat oldHeight = _gridData.topPadding;

if ( _headerView == nil )
{
_gridData.topPadding = 0.0;
Expand All @@ -366,6 +371,10 @@ - (void) setGridHeaderView: (UIView *) newHeaderView
_gridData.topPadding = _headerView.frame.size.height;
}

if ( _gridData.topPadding != oldHeight )
{
[self handleGridViewBoundsChanged:self.bounds toNewBounds:self.bounds];
}
[self setNeedsLayout];
}

Expand All @@ -382,6 +391,8 @@ - (void) setGridFooterView: (UIView *) newFooterView
[_footerView removeFromSuperview];

_footerView = newFooterView;

CGFloat oldHeight = _gridData.bottomPadding;
if ( _footerView == nil )
{
_gridData.bottomPadding = 0.0;
Expand All @@ -392,6 +403,9 @@ - (void) setGridFooterView: (UIView *) newFooterView
_gridData.bottomPadding = _footerView.frame.size.height;
}

if ( _gridData.bottomPadding != oldHeight ) {
[self handleGridViewBoundsChanged:self.bounds toNewBounds:self.bounds];
}
[self setNeedsLayout];
}

Expand Down Expand Up @@ -653,6 +667,14 @@ - (void) layoutSubviews
if ( (_flags.needsReload == 1) && (_animationCount == 0) && (_reloadingSuspendedCount == 0) )
[self reloadData];

if ( (_headerView && _gridData.topPadding != _headerView.frame.size.height ) ||
(_footerView && _gridData.bottomPadding != _footerView.frame.size.height) )
{
_gridData.topPadding = _headerView.frame.size.height;
_gridData.bottomPadding = _footerView.frame.size.height;
[self handleGridViewBoundsChanged:self.bounds toNewBounds:self.bounds];
}

if ( (_reloadingSuspendedCount == 0) && (!CGRectIsEmpty([self gridViewVisibleBounds])) )
{
[self updateVisibleGridCellsNow];
Expand Down Expand Up @@ -1714,8 +1736,9 @@ - (void) updateVisibleGridCellsNow
[self layoutAllCells];
}
}
@catch (id exception)
@catch (__autoreleasing NSException *exception)
{
// do nothing
}
@finally
{
Expand Down