Permalink
Browse files

First attempt at reloading when resized.

  • Loading branch information...
1 parent 9814ba0 commit 08c2964c5b6f73fbfccd09feb5c7f593a8996fe1 @danielctull committed Feb 12, 2010
Showing with 22 additions and 0 deletions.
  1. +1 −0 DTGridView/DTGridView.h
  2. +21 −0 DTGridView/DTGridView.m
@@ -90,6 +90,7 @@ struct DTOutset {
NSMutableArray *cellsOnScreen;
CGPoint oldContentOffset;
+ BOOL hasResized;
BOOL hasLoadedData;
@@ -81,6 +81,22 @@ - (id)initWithFrame:(CGRect)frame {
}
+- (void)setFrame:(CGRect)aFrame {
+
+ CGSize oldSize = self.frame.size;
+ CGSize newSize = aFrame.size;
+
+ if (oldSize.height != newSize.height || oldSize.width != newSize.width) {
+ hasResized = YES;
+ }
+
+ [super setFrame:aFrame];
+
+ if (hasResized) {
+ [self setNeedsLayout];
+ }
+}
+
- (void)reloadData {
[self loadData];
[self setNeedsLayout];
@@ -330,12 +346,17 @@ - (void)checkViews {
isGoingUp = YES;
else if (self.contentOffset.y > oldContentOffset.y && self.contentOffset.y + self.frame.size.height < self.contentSize.height)
isGoingDown = YES;
+ else if (hasResized)
+ isGoingUp = YES;
if (self.contentOffset.x < oldContentOffset.x && self.contentOffset.x >= 0)
isGoingLeft = YES;
else if (self.contentOffset.x > oldContentOffset.x && self.contentOffset.x + self.frame.size.width < self.contentSize.width)
isGoingRight = YES;
+ else if (hasResized)
+ isGoingRight = YES;
+ hasResized = NO;
oldContentOffset = self.contentOffset;
for (DTGridViewCellInfo *info in orderedCells) {

0 comments on commit 08c2964

Please sign in to comment.