A nice looking button in RubyMotion
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
README.md
easy-button.gemspec
example.png

README.md

Easy Button for RubyMotion

A nice looking button in RubyMotion that extends the UIButton class and adds a couple properties for easy styling.

Just pass a single hex value to backgroundColor and get a nice gradient button with a shadow.

You can also more easily set the borderRadius, font, textColor, and title for the button's label. Everything else works just like a UIButton!

Install

Use Bundler to manage gems in RubyMotion.

Rakefile

$:.unshift("/Library/RubyMotion/lib")
require 'motion/project'
require 'bundler'
Bundler.require

Motion::Project::App.setup do |app|
  # Use `rake config' to see complete project settings.
  app.name = 'Testing'
end

Gemfile

source :rubygems

gem 'easy-button'

Run bundle install.

Usage

@button = EasyButton.alloc.initWithFrame([[10, 160], [300, 80]])
@button.backgroundColor = '#ff0000'
@button.borderRadius = 14
@button.font = UIFont.boldSystemFontOfSize(26)
@button.textColor = '#fff'
@button.title = "That Was Easy!"

Screenshot

Easy Button Screenshot

Thanks

Thanks to @seanlilmateus for the inspiration and a bunch of code from CoolButton!