Skip to content
Browse files

Merge branch 'hotfix/1.0.4' into develop

  • Loading branch information...
2 parents d80403b + 1d60af9 commit 88724b30683f65cb4139038f22d32ad2aa2bdfed @danielctull committed Dec 15, 2010
View
1 DTGridView.xcodeproj/project.pbxproj
@@ -299,6 +299,7 @@
GCC_PREFIX_HEADER = DTGridView_Prefix.pch;
INFOPLIST_FILE = "DTGridView-Info.plist";
PRODUCT_NAME = DTGridView;
+ SDKROOT = iphoneos;
};
name = Debug;
};
View
2 DTGridView/DTGridView.h
@@ -183,8 +183,6 @@ struct DTOutset {
*/
- (void)reloadData;
-- (void)positionCheck;
-
@end
#pragma mark -
@protocol DTGridViewDelegate <UIScrollViewDelegate>
View
4 DTGridView/DTGridView.m
@@ -773,8 +773,6 @@ - (void)selectRow:(NSInteger)rowIndex column:(NSInteger)columnIndex scrollPositi
[self scrollViewToRow:rowIndex column:columnIndex scrollPosition:position animated:animated];
}
-- (void)positionCheck {}
-
- (void)fireEdgeScroll {
if (self.pagingEnabled)
@@ -810,7 +808,7 @@ - (void)gridViewCellWasTouched:(DTGridViewCell *)cell {
#pragma mark Accessors
- (NSInteger)numberOfRows {
- if (numberOfRows = DTGridViewInvalid) {
+ if (numberOfRows == DTGridViewInvalid) {
numberOfRows = [self.dataSource numberOfRowsInGridView:self];
}
View
6 DTInfiniteGridView/DTInfiniteGridView.h
@@ -10,15 +10,11 @@
#import "DTGridView.h"
-@interface DTInfiniteGridView : DTGridView {
- BOOL infiniteVerticalScrolling, infiniteHorizontalScrolling;
-
+@interface DTInfiniteGridView : DTGridView {
NSInteger fakeNumberOfRows;
- //NSMutableArray *numberOfColumns;
NSMutableDictionary *numberOfColumns;
NSInteger segmentMultiplier;
-
}
@property (nonatomic, assign) BOOL infiniteVerticalScrolling, infiniteHorizontalScrolling;
View
35 DTInfiniteGridView/DTInfiniteGridView.m
@@ -90,30 +90,35 @@ - (DTGridViewCell *)findViewForRow:(NSInteger)row column:(NSInteger)column {
}
-- (void)positionCheck {
-
- if (!self.infiniteHorizontalScrolling && !self.infiniteVerticalScrolling)
- return;
-
- CGFloat segmentWidth = self.contentSize.width/5;
-
- //CGFloat twotimes = 2*segmentWidth;
+- (void)layoutSubviews {
CGFloat newX = self.contentOffset.x;
CGFloat newY = self.contentOffset.y;
- //NSLog(@"%s:%f %f", _cmd, segmentWidth, self.contentOffset.x);
+ if (self.infiniteHorizontalScrolling) {
+
+ CGFloat segmentWidth = self.contentSize.width/5;
+
+ if (self.contentOffset.x < 2*segmentWidth)
+ newX = self.contentOffset.x + segmentWidth;
+ else if (self.contentOffset.x > 3*segmentWidth)
+ newX = self.contentOffset.x - segmentWidth;
+ }
+
- if (self.contentOffset.x < 2*segmentWidth)
- newX = self.contentOffset.x + segmentWidth;
- else if (self.contentOffset.x > 3*segmentWidth)
- newX = self.contentOffset.x - segmentWidth;
+ if (self.infiniteVerticalScrolling) {
- //NSLog(@"%s:%f", _cmd, newX);
+ CGFloat segmentHeight = self.contentSize.height/5;
+ if (self.contentOffset.y < 2*segmentHeight)
+ newY = self.contentOffset.y + segmentHeight;
+ else if (self.contentOffset.y > 3*segmentHeight)
+ newY = self.contentOffset.y - segmentHeight;
+ }
+
self.contentOffset = CGPointMake(newX, newY);
-
+ [super layoutSubviews];
}
@end

0 comments on commit 88724b3

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