The problem lies in using the scroll_to_row
function. This is intended for simple table views which have only a single section.
The more general function scroll_to_cell
supports both sections and rows. The syntax is slightly different:
def scroll_to_cell(options={:query => "tableView",
:row => 0,
:section => 0,
:scroll_position => :top,
:animate => true})
...
end
for example
scroll_to_cell(:section => 1, :row => 2)
For your case there is also a high-level function each_cell
. For example:
each_cell(:query => "tableView") do |row, sec|
touch("tableViewCell indexPath:#{row},#{sec}")
#...
end