Skip to content

Instantly share code, notes, and snippets.

@trivektor
Forked from aiwilliams/README.md
Created June 24, 2012 03:50
Show Gist options
  • Save trivektor/2981484 to your computer and use it in GitHub Desktop.
Save trivektor/2981484 to your computer and use it in GitHub Desktop.
Storyboard in RubyMotion 1.4

Start XCode and create a new Storyboard file. I closed all my other XCode projects. When you choose the location of the created file, it should be your RubyMotion project's resources directory. Add a UIViewController, and set it's identifier property to "Start". Add some UI elements so you can see it working.

When you run rake in your RubyMotion project, it will compile the .storyboard file. You could auto-load the Storyboard using a plist configuration, but you'll see code can do it too.

class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
storyboard = UIStoryboard.storyboardWithName("Storyboard", bundle: NSBundle.mainBundle)
view_controller = storyboard.instantiateViewControllerWithIdentifier("Start")
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.applicationFrame)
@window.rootViewController = view_controller
@window.makeKeyAndVisible
true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment