motion-imager
motion-imager is a RubyMotion DSL in top of JTSImageViewController by Jared Sinclair allowing you to easily create a "light-box" type view for users to view an image and interact with it.
Installation
- Add
gem 'motion-imager'
to your gemfile - run
bundle
- run
rake pod:install
Usage
Using a UIImage:
MotionImager.new({
image: UIImage.imageNamed('something'),
presenting_from: WeakRef.new(self),
}).show
Using a URL:
MotionImager.new({
url: 'https://www.google.com/images/srpr/logo11w.png',
placeholder: 'my_placeholder_image',
presenting_from: WeakRef.new(self),
}).show
Showing a lightbox with text. This view is only text, no image.
MotionImager.new({
presenting_from: WeakRef.new(self),
transition: :original,
mode: :alt_text,
text: "This is a cool image",
}).show
Manually dismiss the lightbox:
mi = MotionImager.new({
image: UIImage.imageNamed('something'),
presenting_from: WeakRef.new(self),
})
mi.show
mi.dismiss
Access the lightbox controller:
mi = MotionImager.new({
image: UIImage.imageNamed('something'),
presenting_from: WeakRef.new(self),
})
mi.controller
Documentation for all available options:
{
image: UIImage.imageNamed('something'),
url: 'https://www.google.com/images/srpr/logo11w.png',
placeholder: 'my_placeholder.png',
presenting_from: WeakRef.new(self),
transition: :original,
mode: :image,
text: "Some Text",
background: :scaled_blurred,
rect: my_thumbnail.frame,
view: view
}
Roadmap
- Add convenience constructors like:
MotionImager.url({})
, MotionImager.image({})
, and MotionImager.text({})
- Tests. :)
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request