Skip to content

jfahrenkrug/rubymotion_autolayout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RubyMotion Autolayout DSL Demo

This is a very simple RubyMotion app that implements a very basic and generic DSL to create iOS views.

This code...

createViews(%{[label("Welcome")]
              [label("Click on a button!")]
              [image_view("rubymotion")][image_view("rubymotion")][image_view("rubymotion")]
              [button("Say Hi", hi)][button("Say Bye", bye)]})    

… creates this view:

RubyMotion Autolayout Screenshot

How does it work?

createViews is a generic layout method that takes a string like shown above to build a simple UI.

At the moment it simply distributes the available screen real estate evenly to all elements.

It turns "button" into "UIButton", "label" into "UILabel" and "image_view" into "UIImageView"

The first arg in parentheses is the title or the name of a bundled image, the second arg is an action (in case of buttons).

That's it. It's very basic, but I might enhance it in the future.

About

A very basic RubyMotion ASCII DSL to create views

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages