IB
rubymotion interface builder support (yes, with outlets)
Installation
Add this line to your application's Gemfile:
gem 'ib'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ib
In your Rake file:
# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project'
# if you use bundler
require 'bundler'
Bundler.require
# if you are not using bundler
require 'rubygems'
require 'ib'
Motion::Project::App.setup do |app|
# ...
end
Usage
Extend your controllers with IB module:
class SuperController < UIViewController
extend IB
# define attribute accessor
attr_accessor title
# define ib outlet
ib_outlet :title, UILabel
# define action method
def ontouch button
title.text = "Touched!!!"
end
# define ib action
ib_action :ontouch
end
Run rake design
create Storyboard or nibs (put them in resources folder) and you will be able to bind outlets and actions to your ruby code.
Note : add ui.xcodeproj to your .gitignore
Sample app
Here is sample app
- clone it
- run
bundle
- run
rake design
to change story board - run
rake
to run app in simulator
Note : this app is build for iOS 6.0 beta 2
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request