Scroll the tableview all the way to the top when there's a search field and the table index begins with "{search}". Fixes #159 on MASTER branch.

This commit is contained in:
Mark Rickert
2013-06-18 16:49:06 -04:00
parent 6358b2b041
commit 7b2ea668c5

View File

@@ -139,6 +139,17 @@ module ProMotion
end
end
def tableView(tableView, sectionForSectionIndexTitle:title, atIndex:index)
return index unless ["{search}", UITableViewIndexSearch].include?(self.table_data_index[0])
if index == 0
tableView.setContentOffset(CGPointZero, animated:false)
NSNotFound
else
index-1
end
end
def deleteRowsAtIndexPaths(indexPaths, withRowAnimation:animation)
PM.logger.warn "ProMotion expects you to use 'delete_cell(index_paths, animation)'' instead of 'deleteRowsAtIndexPaths(indexPaths, withRowAnimation:animation)'."
delete_cell(indexPaths, animation)