Skip to content

Instantly share code, notes, and snippets.

@ahmetus
Forked from aiwilliams/README.md
Created November 1, 2012 19:48
Show Gist options
  • Save ahmetus/3995997 to your computer and use it in GitHub Desktop.
Save ahmetus/3995997 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