Last modification by jamonholmgren
January 29, 2013, 9:18 pm → version: 2
How to get started building an iPad app using ProMotion and RubyMotion 20 users byViewed: 3672 times
|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!
|First, open Terminal and go to your code projects folder.|
|Run `motion create ipad-demo` to create a new RubyMotion app.|
|Now open it in your favorite code editor. Mine is Sublime Text 2.|
|Create a Gemfile (so we can use Bundler) and add the following:
gem "ProMotion", :git => "git://github.com/clearsightstudio/ProMotion.git", :branch => "refactor"
|From the Terminal, run `bundle` to install ProMotion.|
|Open the app_delegate.rb file and replace the contents entirely with this:
class AppDelegate < ProMotion::AppDelegateParent
def on_load(app, options)
|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'`:
|Now run `rake` in Terminal to compile and run your new app.|
|The simulator will show a black screen. We want something a little more exciting.|
|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"
set_tab_bar_item system_icon: UITabBarSystemItemContacts
|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:
|Kill the app by pressing Ctrl+C in your terminal and re-run `rake`. This time you'll see the tab bar below.|
|Let's add an about_screen.rb too.
class AboutScreen < ProMotion::Screen
title "About Us"
set_tab_bar_item system_icon: UITabBarSystemItemFeatured
|Go back to your app_delegate.rb and add it as a second tab.
open_tab_bar HomeScreen, AboutScreen
|Re-run `rake` and admire the two tabs.|
|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!|
What do you think about this tutorial ?