O'Reilly logo

RubyMotion by Clay Allsopp

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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
 

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required