We know that it's not so much fun to have only a simple HelloWorld
pop-up as our very first application, so let's jazz up our code by adding some more goodies to our alert box; and this time, let's do things in a much better way.
Earlier we had added an alert box in the delegate itself. Actually it is not a good idea to write code in the application delegate. It is better to write code in a Model-View-Controller (MVC) way. Right now we won't cover all three parts of the MVC architecture for now let's begin with the controller for our application and add three buttons in this alert box, add a title, and add a message for the title box.
The class UIAlertView
that we've used in the last section has numerous properties, such as title, message, delegate, cancelButtonTitle, otherButtonTitles, and many more. Let's use a few of them in our application as follows:
Create a file
root_controller.rb
in theapp
folder and add the following code:class RootController < UIViewController...