Code Monkey home page Code Monkey logo

motion-awesome's Introduction

MotionAwesome - as if more awesomeness was needed...

MotionAwesome Screenshots

FontAwesome (http://fortawesome.github.io/Font-Awesome) is a really cool way to bring in some low cost bang! to your web applications. Following on that lead, MotionAwesome brings similar awesomeness in the RubyMotion world...

For the star-gizzards ;-)

> git clone https://github.com/derailed/motion-awesome.git
> cd motion-awesome
> rake

Installation

gem install motion-awesome

Dependencies

Issues? Try this!

If you are adding motion-awesome to an existing project, you may run into a common issue with RubyMotion where the added font file is not copied from the resources.
To fix this simply run a rake clean and then try again.

Usage

Creating awesome labels

class WannaBeCoolController < XXXController
  include MotionAwesome
  
  def viewDidLoad
    label( :flag, size: 200 ) do |label|
      self.view.addSubview(label)
    end
  end
end

Creating awesome buttons

class WannaBeCoolController < XXXController  
  def viewDidLoad
    MotionAwesome.button( :legal, size: 40, text:%q{Hit me!} ) do |button|
      button.titleLabel.textColor = 0xFB3223.uicolor
      button.titleLabel.font      = UIFont.fontWithName( 'GillSans', size:30 )
      button.addTarget( self,
                        action: "cb:",
                        forControlEvents: UIControlEventTouchUpInside )
      self.view.addSubview( button )
  end
end

Settings

What's my name?

With MotionAwesome you have access to all the latest icons available on the FontAwesome site.

In order to specify the icon name you can use a symbol for the name minus the 'icon-' prefix and sub out the '-' with '_'. Simple!

FontAwesome     => MotionAwesome
icon-flag       => :flag
icon-star-empty => :star_empty

Options

Awesomization is currently in effect for UILabel and UIButton.

The method signatures following this strategy:

 awesome_label  = label( :icon_name, opts ) do {|comp| ... }
 awesome_button = button( :icon_name, opts ) do {|comp| ... } 

Options are as follows:

  • size: specifies the size of the icon. To size the text portion you can set the font of your liking. If no size is specified the icon will be sized according to the active font size.
  • type: :custom | :rounded. Specifies the type of UIButton to create -- For button only! -
  • text: prepends some text to your decorated label or button.
  • color: sets the icon color. If this is not set the icon color will match the text color if specified.

ATTA BOY!

This gem was inspired by Hiroshi Horiki(@pchw) https://github.com/pchw/fontawesome

Contact

Fernand Galiana

Still work in progress. So please feel to fork or contact me if you run into issues or just want to send some good vibes...

License

MotionAwesome is released under the MIT license.

History

  • 0.0.1:
    • Initial drop
  • 0.0.2:
    • Bug fixes and cleanup
  • 0.0.3:
    • Mo' spring cleaning
  • 0.0.4:
    • Additional clean up
  • 0.0.5:
    • Upgrade to RM 2.0
    • Upgrade to FontAwesome 3.1.1 - 302 icons. Yeah!

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.