Fix for errors with variable row height edge cases.

This commit is contained in:
Randall Luecke committed 2011-03-15 18:02:26 -04:00
1 parent 24fbf27880
commit a3e6105a11
1 file changed
+15 -5
+15 -5
View File
@@ -1390,7 +1390,7 @@ NOT YET IMPLEMENTED
_numberOfRows = [[destination valueForKeyPath:keyPath] count];
}
else if (_dataSource && (_implementedDataSourceMethods & CPTableViewDataSource_numberOfRowsInTableView_))
_numberOfRows = [_dataSource numberOfRowsInTableView:self];
_numberOfRows = [_dataSource numberOfRowsInTableView:self] || 0;
else
{
if (_dataSource)
@@ -1597,10 +1597,20 @@ NOT YET IMPLEMENTED
if (_implementedDelegateMethods & CPTableViewDelegate_tableView_heightOfRow_)
{
var rowToLookUp = MIN(aRowIndex, lastIndex),
y = _cachedRowHeights[rowToLookUp].heightAboveRow,
height = _cachedRowHeights[rowToLookUp].height + _intercellSpacing.height,
rowDelta = aRowIndex - rowToLookUp;
var rowToLookUp = MIN(aRowIndex, lastIndex);
// if the row doesn't exist
if (rowToLookUp !== CPNotFound)
{
var y = _cachedRowHeights[rowToLookUp].heightAboveRow,
height = _cachedRowHeights[rowToLookUp].height + _intercellSpacing.height,
rowDelta = aRowIndex - rowToLookUp;
}
else
{
y = aRowIndex * (_rowHeight + _intercellSpacing.height);
height = _rowHeight + _intercellSpacing.height;
}
// if we need the rect of a row past the last index
if (rowDelta > 0)