Fixed: in the last few revisions, table rows could be selected despite delegate shouldSelectRow: returning NO.

This error was caused by 3612565e3a dropping the return statement.

Refs #1905.
This commit is contained in:
Alexander Ljungberg committed 2013-05-09 14:05:53 -07:00
1 parent 48be680fde
commit 626e1e770e
1 file changed
+9 -10
+9 -10
View File
@@ -5260,19 +5260,18 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
{
var shouldSelect = [_delegate tableView:self shouldSelectRow:i];
if (!shouldSelect)
/* If shouldSelect returns NO it means this row cannot be selected.
The proper behaviour is to then try to see if the next/previous
row(s) can be selected, until we hit the first one that can be.
*/
while (!shouldSelect && (i < [self numberOfRows] && i > 0))
{
/* If shouldSelect returns NO it means this row cannot be selected.
The proper behaviour is to then try to see if the next/previous
row(s) can be selected, until we hit the first one that can be.
*/
while (!shouldSelect && (i < [self numberOfRows] && i > 0))
{
shouldGoUpward ? --i : ++i; //check to see if the row can be selected if it can't be then see if the next row can be selected
shouldSelect = [_delegate tableView:self shouldSelectRow:i];
}
shouldGoUpward ? --i : ++i; //check to see if the row can be selected. If it can't be then see if the next row can be selected.
shouldSelect = [_delegate tableView:self shouldSelectRow:i];
}
if (!shouldSelect)
return;
}
// If we go upward and see that this row is already selected we should deselect the row below.