
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
motion-horizontal-scroll
Advanced tools
This is a horizontal scroll controller for iOS, that mimics the Pulse UI. The basic functionality is borrowed from a codebase and it is the reason why we were able to come up with this gem, so hats off to the authors! Also, a ton of thanks to lorempixel from where we have pulled in images to feed the sample app.


Below is a description of how you can integrate and use this gem in your codebase.
gem "motion-horizontal-scroll"
I have included a sample app for reference. To execute it, clone the repo to your local folder and run the following:
bundle install
rake
Nevertheless, the basic setup for a single row can be achieved as follows:
horizontal_row = HorizontalTableContainerCell.alloc.initWithStyle(UITableViewCellStyleSubtitle, reuseIdentifier: <REUSE_IDENTIFIER>)
horizontal_row.delegate = <DELEGATE>
horizontal_row.vertical_row_offset = <VERTICAL_ROW_OFFSET>
cell = horizontal_row.set_dimensions_with_row_offset
cell.items_list = <DATA ARRAY>
cell.selectionStyle = UITableViewCellSelectionStyleNone
cell
###Supplying the title and image
The data required for a single cell has two properties, namely a name and an image. The name is the title that appears underneath the image in the cell. The image itself can be fed in two formats:
An instance of UIImage with initialized with an image.
A URL to an image along with a placeholder image; this requires either the gem afmotion or the pod AFNetworking. The pod on its own may be insufficient, but there's a category called UIImageView+AFNetworking that can start an asynchronous download of an image when given an NSURLRequest.
###Available delegate methods
This refers to a callback that indicates a particular cell has been tapped. The syntax of the method for the same is as follows:
horizontal_scroll_cell_selected(item, index)
The specifics of a cell that need to be set are the title and image. The delegate method for setting cell details is:
set_item_details_for_horizontal_scroll_cell(cell, item)
To set the cell title, you can use the following method:
cell.set_title_label_text text
To set the image, there are two possible methods based on the format as specified above.
cell.set_thumbnail_image image # image is an instance of UIImage
setImageWithURL method for the UIImageView class which can be availed by installing the afmotion gem (in Objective-C, this would be available in the UIImageView+AFNetworking category). The two arguments it takes are the URL to the image and the name of a locally available placeholder image. The syntax is:cell.set_thumbnail_image_with_url image_url, placeholder # image_url is a URL in form of a string and the placeholder is a local image that can take the place of the image until it loads
FAQs
Unknown package
We found that motion-horizontal-scroll demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.