Skip to content
This repository has been archived by the owner on May 8, 2020. It is now read-only.

Commit

Permalink
variable initialisation to keep clang happy/quiet
Browse files Browse the repository at this point in the history
  • Loading branch information
aufflick committed Oct 21, 2010
1 parent 0ccf34c commit 991343a
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions DTGridView/DTGridView.m
Expand Up @@ -200,6 +200,18 @@ - (void)addCellWithInfo:(NSObject<DTGridViewCellInfoProtocol> *)info {
[[gridCells objectAtIndex:info.yPosition] replaceObjectAtIndex:info.xPosition withObject:cell]; [[gridCells objectAtIndex:info.yPosition] replaceObjectAtIndex:info.xPosition withObject:cell];


[self insertSubview:cell atIndex:0]; [self insertSubview:cell atIndex:0];

// remove any existing view at this frame
for (UIView *v in self.subviews) {
if (v.frame.origin.x == cell.frame.origin.x &&
v.frame.origin.y == cell.frame.origin.y &&
v != cell)
{
[v removeFromSuperview];
break;
}
}

[cell release]; [cell release];


} }
Expand Down Expand Up @@ -286,8 +298,8 @@ - (void)loadData {


NSMutableArray *cellInfoArrayRows = [[NSMutableArray alloc] init]; NSMutableArray *cellInfoArrayRows = [[NSMutableArray alloc] init];


CGFloat maxHeight; CGFloat maxHeight = 0;
CGFloat maxWidth; CGFloat maxWidth = 0;




for (NSInteger i = 0; i < self.numberOfRows; i++) { for (NSInteger i = 0; i < self.numberOfRows; i++) {
Expand Down Expand Up @@ -356,6 +368,18 @@ - (void)loadData {
self.gridCells = cellInfoArrayRows; self.gridCells = cellInfoArrayRows;
[cellInfoArrayRows release]; [cellInfoArrayRows release];


if ([self.subviews count] > [self.gridCells count]) {
// the underlying data must have reduced, time to iterate
NSSet *gridCellsSet = [NSSet setWithArray:self.gridCells];
NSArray *subviewsCopy = [self.subviews copy];

for (DTGridViewCell *cell in subviewsCopy) {
if (![gridCellsSet member:cell])
[cell removeFromSuperview];
}

[subviewsCopy release];
}
} }


- (void)checkViews { - (void)checkViews {
Expand Down Expand Up @@ -574,7 +598,7 @@ - (DTGridViewCell *)cellForRow:(NSInteger)rowIndex column:(NSInteger)columnIndex


- (void)scrollViewToRow:(NSInteger)rowIndex column:(NSInteger)columnIndex scrollPosition:(DTGridViewScrollPosition)position animated:(BOOL)animated { - (void)scrollViewToRow:(NSInteger)rowIndex column:(NSInteger)columnIndex scrollPosition:(DTGridViewScrollPosition)position animated:(BOOL)animated {


CGFloat xPos, yPos; CGFloat xPos = 0, yPos = 0;


CGRect cellFrame = [[[self.gridCells objectAtIndex:rowIndex] objectAtIndex:columnIndex] frame]; CGRect cellFrame = [[[self.gridCells objectAtIndex:rowIndex] objectAtIndex:columnIndex] frame];


Expand Down

0 comments on commit 991343a

Please sign in to comment.