Created
February 7, 2017 12:37
-
-
Save Bodacious/696911771357d961ec08f3634b88e6fc to your computer and use it in GitHub Desktop.
RubyMotion Hello World example.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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