| ![]() Last modification by jamonholmgren
January 29, 2013, 9:18 pm → version: 2 Language: English Rating: ![]() ![]() ![]() ![]() ![]() Viewed: 450 times |
1 | You need a few things first: 1. A relatively modern Mac (I'm using my 2012 Mac Mini I bought for home) 2. A licensed copy of RubyMotion (www.rubymotion.com, $199) 3. Latest version of Xcode installed Let's get started! |
2 | First, open Terminal and go to your code projects folder. |
3 | Run `motion create ipad-demo` to create a new RubyMotion app. |
4 | Now open it in your favorite code editor. Mine is Sublime Text 2. |
5 | Create a Gemfile (so we can use Bundler) and add the following:source :rubygems gem "ProMotion", :git => "git://github.com/clearsightstudio/ProMotion.git", :branch => "refactor" |
6 | From the Terminal, run `bundle` to install ProMotion. |
7 | Open the app_delegate.rb file and replace the contents entirely with this:class AppDelegate < ProMotion::AppDelegateParent def on_load(app, options) end end |
8 | Now we need to tell the simulator that we want to target iPad. Go to your Rakefile and add this line:app.device_family = [:ipad] Also add this to the top in place of `require 'motion/project'`: require "rubygems" require 'motion/project' require 'bundler' Bundler.require |
9 | Now run `rake` in Terminal to compile and run your new app. |
10 | The simulator will show a black screen. We want something a little more exciting. |
11 | Add a folder named "screens" in your /app folder and create a file named "home_screen.rb" with these contents:class HomeScreen < ProMotion::Screen title "Home Screen" def on_load set_tab_bar_item system_icon: UITabBarSystemItemContacts end end |
12 | We want the app to open this screen in a tab bar on startup, so open up your app_delegate and add this line to the middle of the on_load method:open_tab_bar HomeScreen |
13 | Kill the app by pressing Ctrl+C in your terminal and re-run `rake`. This time you'll see the tab bar below. |
14 | Let's add an about_screen.rb too.class AboutScreen < ProMotion::Screen title "About Us" def on_load set_tab_bar_item system_icon: UITabBarSystemItemFeatured end end |
15 | Go back to your app_delegate.rb and add it as a second tab.open_tab_bar HomeScreen, AboutScreen |
16 | Re-run `rake` and admire the two tabs. |
17 | That's all I have time for today. Go to my web design website, http://www.clearsightstudio.com/, to learn more about ProMotion and see other tutorials! |
| Rating |
|
|
What do you think about this tutorial ?
|
|
| Ads |
|||||
|
| |||||
| Comments |
|
|
|
|
About

Advanced
What's New
The Best tutorials















