Showing a Message with UIAlertView

Now that we understand how our app boots up and we have our entry point, let’s try something. We’re going to show a UIAlertView, which is the standard blue pop-up you see when you get an error message or push notifications pre-iOS5. Let’s change application:didFinishLaunchingWithOptions: to add an alert right before returning.

 class​ AppDelegate
 def​ application(application, didFinishLaunchingWithOptions​:launchOptions​)
» @alert =
» UIAlertView.alloc.initWithTitle(​"Hello"​,
»message: ​​"Hello, RubyMotion"​,
»delegate: ​​nil​,
»cancelButtonTitle: ​​"OK"​,
»otherButtonTitles: ​​nil​)
» @alert.show
»
» puts ​"Hello from the console!"
 
 true
 end
 

Get RubyMotion now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.