Skip to content

Instantly share code, notes, and snippets.

@makevoid
Last active December 15, 2015 06:09
Show Gist options
  • Select an option

  • Save makevoid/5214609 to your computer and use it in GitHub Desktop.

Select an option

Save makevoid/5214609 to your computer and use it in GitHub Desktop.
Hello (UIViewController) world - RubyMotion
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
player_controller = MainController.alloc.init
window = UIWindow.alloc.initWithFrame UIScreen.mainScreen.bounds
window.rootViewController = player_controller
window.rootViewController.wantsFullScreenLayout = true
window.makeKeyAndVisible
true
end
end
class MainController < UIViewController
def viewDidLoad
button = UIButton.buttonWithType UIButtonTypeRoundedRect
button.setTitle "Hello world", forState: UIControlStateNormal
button.frame = CGRectMake 80.0, 210.0, 160.0, 40.0
self.view.addSubview button
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment