calabash/calabash-ios-server — pull request #31 by jmoody (2014-02-06 09:18:47+00:00)
Title: WIP rudimentary support of scrolling to items in UICollectionViews

## Action Items

needs review by/with

- [ ] @krukow
- [ ] @LiohAu

you can either grab this pull request or you can the framework from here:

https://s3-eu-west-1.amazonaws.com/littlejoysoftware-eu/public/calabash.framework.tar.gz

## Motivation

calabash has great support for scroll to rows in UITableViews.

calabash should support scrolling to items on UICollectionViews.

## client side

```
def scroll_to_collection_item(item, section, opts={})
default_options = {:query => 'collectionView',
:scroll_position => :top,
:animate => true}
opts = default_options.merge(opts)
uiquery = opts[:query]

scroll_position = opts[:scroll_position]
candidates = [:top, :center_vertical, :bottom, :left, :center_horizontal, :right]
unless candidates.include?(scroll_position)
raise "scroll_position '#{scroll_position}' is not one of '#{candidates}'"
end

animate = opts[:animate]

views_touched=map(uiquery, :collectionViewScroll, item.to_i, section.to_i, scroll_position, animate)
msg = "unable to scroll: '#{uiquery}' to row '#{item}' in section '#{section}'"
assert_map_results(views_touched, msg)
views_touched
end
```