Skip to content

Instantly share code, notes, and snippets.

@Bodacious
Created February 7, 2017 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bodacious/696911771357d961ec08f3634b88e6fc to your computer and use it in GitHub Desktop.
Save Bodacious/696911771357d961ec08f3634b88e6fc to your computer and use it in GitHub Desktop.
RubyMotion Hello World example.
class AppDelegate
def hello_world_label
@hello_world_label ||= begin
frame = CGRectMake(20,200,280,40)
label = UILabel.alloc.initWithFrame(frame)
label.text = "Hello world"
label.textColor = UIColor.whiteColor
label.textAlignment = UITextAlignmentCenter
label
end
end
def window
@window ||= UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
end
def application(application, didFinishLaunchingWithOptions: launchOptions)
window.addSubview(hello_world_label)
window.makeKeyAndVisible
true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment