Git Product home page Git Product logo

rmq-slide-over-control's Introduction

image

rmq-slide-over-control

===================

RMQ plugin for RubyMotion. A control that places a draggable view over another view, allowing the user to show more or less of the main view below

image

===================

Installation

Requires RMQ 0.8.0 or later, and iOS 7 or later

Add this line to your application's Gemfile:

gem 'rmq-slide-over-control', :git => '[email protected]:infinitered/rmq-slide-over-control.git'

And then execute:

$ bundle

Usage

See the sample app in this repo (just download the repo and run it, look in /app for files).

Parts

image

Example using stylesheet:

In your controller:

@slide_over_control = rmq.append!(SlideOverControl, :slide_over_control).tap do |o|
  o.main_view = rmq.create!(UIImageView, :photo_of_kittens)
  o.top_view = rmq.create!(UITextView, :kittens_description)
  rmq(o.slide_bar).append(UILabel, :slide_bar_label)
end

In your stylesheet:

def slide_over_control(st)
  st.frame = :full

  st.slide_bar_top_margin = 74
  st.slide_bar_top_snap_back_to = 174

  # Where the side_bar starts at
  st.slide_bar_center = rmq.device.screen_height / 2

  st.slide_bar_bottom_margin = 0
  st.slide_bar_bottom_snap_back_to = 130

  st.top_view_container_background_color = color.white

  # Other options
  # st.slide_bar_height = 40
  # st.auto_close = false
  # st.slide_bar_background_color = color.dark_gray
  # st.top_view_container_background_color = color.white
end

def photo_of_kittens(st)
  st.image = image.resource('kittens')
end

def kittens_description(st)
  st.background_color = color.light_gray
end

If you don't use stylesheets, then just call the same methods that are in the style:

my_view = rmq.append! SlideOverControl
my_view.slide_bar_top_margin = 74
# etc

Methods

@slide_over_control.open
@slide_over_control.close
@slide_over_control.main_view = foo
@slide_over_control.top_view = bar
@slide_over_control.auto_close = true

@slide_over_control.after_close{ do_something }
@slide_over_control.after_auto_close{ do_something }
@slide_over_control.after_open{ do_something }

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.