Permalink
Browse files

Merge branch 'master' into production

  • Loading branch information...
2 parents a40a16a + cdcebdf commit 0b518246026e7373611195376af83d03781c9948 @danielctull committed Feb 20, 2011
View
@@ -96,8 +96,8 @@ struct DTOutset {
NSInteger numberOfRows;
- NSInteger rowIndexOfSelectedCell;
- NSInteger columnIndexOfSelectedCell;
+ NSUInteger rowIndexOfSelectedCell;
+ NSUInteger columnIndexOfSelectedCell;
NSTimer *decelerationTimer;
NSTimer *draggingTimer;
@@ -160,7 +160,7 @@ struct DTOutset {
@param columnIndex The index of the column of the wanted cell.
@return The grid view cell of the grid or nil if the cell is not visible or the indexes is out of range.
*/
-- (DTGridViewCell *)cellForRow:(NSInteger)rowIndex column:(NSInteger)columnIndex;
+- (DTGridViewCell *)cellForRow:(NSUInteger)rowIndex column:(NSUInteger)columnIndex;
/*!
@abstract A constant that identifies a relative position in the receiving table view (top, middle, bottom) for row when scrolling concludes. See “Table View Scroll Position” a descriptions of valid constants.
@@ -169,9 +169,9 @@ struct DTOutset {
@param position The position the cell should be in once scrolled to.
@param animated If this
*/
-- (void)scrollViewToRow:(NSInteger)rowIndex column:(NSInteger)columnIndex scrollPosition:(DTGridViewScrollPosition)position animated:(BOOL)animated;
+- (void)scrollViewToRow:(NSUInteger)rowIndex column:(NSUInteger)columnIndex scrollPosition:(DTGridViewScrollPosition)position animated:(BOOL)animated;
-- (void)selectRow:(NSInteger)rowIndex column:(NSInteger)columnIndex scrollPosition:(DTGridViewScrollPosition)position animated:(BOOL)animated;
+- (void)selectRow:(NSUInteger)rowIndex column:(NSUInteger)columnIndex scrollPosition:(DTGridViewScrollPosition)position animated:(BOOL)animated;
/*!
@abstract This method should be used by subclasses to know when the grid did appear on screen.
@@ -221,4 +221,4 @@ The grid view object requesting this information.
- (NSInteger)spacingBetweenRowsInGridView:(DTGridView *)gridView;
- (NSInteger)spacingBetweenColumnsInGridView:(DTGridView *)gridView;
-@end
+@end
View
@@ -13,7 +13,7 @@
@interface DTGridViewCellInfo : NSObject <DTGridViewCellInfoProtocol> {
- NSInteger xPosition, yPosition;
+ NSUInteger xPosition, yPosition;
CGRect frame;
CGFloat x, y, width, height;
}
@@ -34,7 +34,7 @@ - (void)checkViews;
- (void)initialiseViews;
- (void)fireEdgeScroll;
- (void)checkNewRowStartingWithCellInfo:(NSObject<DTGridViewCellInfoProtocol> *)info goingUp:(BOOL)goingUp;
-- (NSObject<DTGridViewCellInfoProtocol> *)cellInfoForRow:(NSInteger)row column:(NSInteger)col;
+- (NSObject<DTGridViewCellInfoProtocol> *)cellInfoForRow:(NSUInteger)row column:(NSUInteger)col;
- (void)checkRow:(NSInteger)row column:(NSInteger)col goingLeft:(BOOL)goingLeft;
@@ -140,7 +140,7 @@ - (void)reloadData {
- (void)drawRect:(CGRect)rect {
- oldContentOffset = CGPointMake(0.0, 0.0);
+ oldContentOffset = CGPointMake(0.0f, 0.0f);
//hasLoadedData = NO;
@@ -380,7 +380,7 @@ - (void)loadData {
CGFloat x;
if (i == 0) {
- y = 0.0;
+ y = 0.0f;
//info.frame.origin.y = 0.0;
} else {
DTGridViewCellInfo *previousCellRow = [[cellInfoArrayRows objectAtIndex:i-1] objectAtIndex:0];
@@ -391,7 +391,7 @@ - (void)loadData {
}
if (j == 0) {
- x = 0.0;
+ x = 0.0f;
} else {
DTGridViewCellInfo *previousCellRow = [cellInfoArrayCols objectAtIndex:j-1];
x = previousCellRow.frame.origin.x + previousCellRow.frame.size.width;
@@ -478,19 +478,20 @@ - (void)checkViews {
for (DTGridViewCellInfo *info in orderedCells) {
- if (isGoingLeft){
- if (info.xPosition > 0 && info.frame.origin.x > self.contentOffset.x)
+ if (isGoingLeft) {
+ if (info.xPosition > 0 && info.frame.origin.x > self.contentOffset.x) {
if (![leftRightCells objectForKey:[NSString stringWithFormat:@"%i", info.yPosition]])
[leftRightCells setObject:info forKey:[NSString stringWithFormat:@"%i", info.yPosition]];
else if ([[leftRightCells objectForKey:[NSString stringWithFormat:@"%i", info.yPosition]] xPosition] > info.xPosition)
[leftRightCells setObject:info forKey:[NSString stringWithFormat:@"%i", info.yPosition]];
-
+ }
} else if (isGoingRight) {
- if ([[self.gridCells objectAtIndex:info.yPosition] count] - 1 > info.xPosition && info.frame.origin.x + info.frame.size.width < self.contentOffset.x + self.frame.size.width)
+ if ([[self.gridCells objectAtIndex:info.yPosition] count] - 1 > info.xPosition && info.frame.origin.x + info.frame.size.width < self.contentOffset.x + self.frame.size.width) {
if (![leftRightCells objectForKey:[NSString stringWithFormat:@"%i", info.yPosition]])
[leftRightCells setObject:info forKey:[NSString stringWithFormat:@"%i", info.yPosition]];
else if ([[leftRightCells objectForKey:[NSString stringWithFormat:@"%i", info.yPosition]] xPosition] < info.xPosition)
[leftRightCells setObject:info forKey:[NSString stringWithFormat:@"%i", info.yPosition]];
+ }
}
if (![self cellInfoShouldBeOnShow:info])
@@ -523,7 +524,7 @@ - (void)checkViews {
- (void)initialiseViews {
- for (NSInteger i = 0; i < [cellInfoForCellsOnScreen count]; i++) {
+ for (NSUInteger i = 0; i < [cellInfoForCellsOnScreen count]; i++) {
DTGridViewCellInfo *info = [cellInfoForCellsOnScreen objectAtIndex:i];
@@ -532,11 +533,11 @@ - (void)initialiseViews {
}
- for (NSInteger i = 0; i < [gridCells count]; i++) {
+ for (NSUInteger i = 0; i < [gridCells count]; i++) {
NSMutableArray *row = [gridCells objectAtIndex:i];
- for (NSInteger j = 0; j < [row count]; j++) {
+ for (NSUInteger j = 0; j < [row count]; j++) {
id object = [row objectAtIndex:j];
@@ -570,9 +571,7 @@ - (void)checkRow:(NSInteger)row column:(NSInteger)col goingLeft:(BOOL)goingLeft
}
}
-- (NSObject<DTGridViewCellInfoProtocol> *)cellInfoForRow:(NSInteger)row column:(NSInteger)col {
-
- if (row < 0 || col < 0) return nil;
+- (NSObject<DTGridViewCellInfoProtocol> *)cellInfoForRow:(NSUInteger)row column:(NSUInteger)col {
if ([self.gridCells count] <= row) return nil;
@@ -646,7 +645,7 @@ - (DTGridViewCell *)dequeueReusableCellWithIdentifier:(NSString *)identifier {
return nil;
}
-- (DTGridViewCell *)cellForRow:(NSInteger)rowIndex column:(NSInteger)columnIndex {
+- (DTGridViewCell *)cellForRow:(NSUInteger)rowIndex column:(NSUInteger)columnIndex {
for (UIView *v in self.subviews) {
if ([v isKindOfClass:[DTGridViewCell class]]) {
@@ -659,7 +658,7 @@ - (DTGridViewCell *)cellForRow:(NSInteger)rowIndex column:(NSInteger)columnIndex
return nil;
}
-- (void)scrollViewToRow:(NSInteger)rowIndex column:(NSInteger)columnIndex scrollPosition:(DTGridViewScrollPosition)position animated:(BOOL)animated {
+- (void)scrollViewToRow:(NSUInteger)rowIndex column:(NSUInteger)columnIndex scrollPosition:(DTGridViewScrollPosition)position animated:(BOOL)animated {
CGFloat xPos = 0, yPos = 0;
@@ -743,12 +742,12 @@ - (void)scrollViewToRow:(NSInteger)rowIndex column:(NSInteger)columnIndex scroll
if (xPos > self.contentSize.width - self.frame.size.width)
xPos = self.contentSize.width - self.frame.size.width;
else if (xPos < 0)
- xPos = 0.0;
+ xPos = 0.0f;
if (yPos > self.contentSize.height - self.frame.size.height)
yPos = self.contentSize.height - self.frame.size.height;
else if (yPos < 0)
- yPos = 0.0;
+ yPos = 0.0f;
[self scrollRectToVisible:CGRectMake(xPos, yPos, self.frame.size.width, self.frame.size.height) animated:animated];
@@ -761,7 +760,7 @@ - (void)scrollViewToRow:(NSInteger)rowIndex column:(NSInteger)columnIndex scroll
}
-- (void)selectRow:(NSInteger)rowIndex column:(NSInteger)columnIndex scrollPosition:(DTGridViewScrollPosition)position animated:(BOOL)animated {
+- (void)selectRow:(NSUInteger)rowIndex column:(NSUInteger)columnIndex scrollPosition:(DTGridViewScrollPosition)position animated:(BOOL)animated {
for (UIView *v in self.subviews) {
if ([v isKindOfClass:[DTGridViewCell class]]) {
View
@@ -18,7 +18,7 @@
*/
@interface DTGridViewCell : UIView <DTGridViewCellInfoProtocol> {
- NSInteger xPosition, yPosition;
+ NSUInteger xPosition, yPosition;
NSString *identifier;
BOOL selected;
@@ -7,6 +7,6 @@
//
@protocol DTGridViewCellInfoProtocol
-@property (nonatomic, assign) NSInteger xPosition, yPosition;
+@property (nonatomic, assign) NSUInteger xPosition, yPosition;
@property (nonatomic, assign) CGRect frame;
@end
View
@@ -35,14 +35,14 @@ - (void)dealloc {
- (NSInteger)numberOfRowsInGridView:(DTGridView *)gridView {
return 0;
}
-- (NSInteger)numberOfColumnsInGridView:(DTGridView *)gridView forRowWithIndex:(NSInteger)index {
+- (NSInteger)numberOfColumnsInGridView:(DTGridView *)gridView forRowWithIndex:(NSInteger)theIndex {
return 0;
}
- (CGFloat)gridView:(DTGridView *)gridView heightForRow:(NSInteger)rowIndex {
- return 0.0;
+ return 0.0f;
}
- (CGFloat)gridView:(DTGridView *)gridView widthForCellAtRow:(NSInteger)rowIndex column:(NSInteger)columnIndex {
- return 0.0;
+ return 0.0f;
}
- (DTGridViewCell *)gridView:(DTGridView *)gridView viewForRow:(NSInteger)rowIndex column:(NSInteger)columnIndex {
return nil;
@@ -121,4 +121,4 @@ - (void)layoutSubviews {
[super layoutSubviews];
}
-@end
+@end
@@ -46,10 +46,10 @@ - (void)drawRect:(CGRect)rect {
NSInteger halfHeight = (NSInteger)(self.frame.size.height/2.0);
CGSize labelSize = [self.titleLabel.text sizeWithFont:self.titleLabel.font];
- self.titleLabel.frame = CGRectMake(0.0, halfHeight-labelSize.height, labelSize.width, labelSize.height);
+ self.titleLabel.frame = CGRectMake(0.0f, halfHeight-labelSize.height, labelSize.width, labelSize.height);
labelSize = [self.subtitleLabel.text sizeWithFont:self.subtitleLabel.font];
- self.subtitleLabel.frame = CGRectMake(0.0, halfHeight+1.0, labelSize.width, labelSize.height);
+ self.subtitleLabel.frame = CGRectMake(0.0f, halfHeight+1.0f, labelSize.width, labelSize.height);
[self addSubview:self.titleLabel];
[self addSubview:self.subtitleLabel];
@@ -44,7 +44,7 @@ - (void)didEndMoving {
}
- (CGFloat)findWidthForRow:(NSInteger)row column:(NSInteger)column {
- NSInteger w = (NSInteger)self.frame.size.width/3;
+ NSInteger w = (NSInteger)self.frame.size.width/3.0f;
return (CGFloat)w;
}
@@ -17,4 +17,4 @@
@property (nonatomic, assign) CGFloat slideAmount;
-@end
+@end

0 comments on commit 0b51824

Please sign in to comment.