Book Image

RubyMotion iOS Development Essentials

By : Abhishek Nalwaya, Akshat Paul
Book Image

RubyMotion iOS Development Essentials

By: Abhishek Nalwaya, Akshat Paul

Overview of this book

RubyMotion is a revolutionary toolchain for iOS app development. With RubyMotion, you can quickly develop and test native iOS apps for the iPhone and iPad, combining the expressiveness and simplicity of Ruby with the power of the iOS SDK. "RubyMotion iOS Development Essentials" is a hands-on guide for developing iOS apps using RubyMotion. With RubyMotion, you can eliminate the complexity and confusion associated with the development of iOS applications using Objective-C. We'll begin from scratch. Starting by installing RubyMotion, we'll build ourselves up to developing an app that uses the various device capabilities iOS has to offer. What's more, we'll even learn how to launch your app on the App Store! We'll also learn to use iOS SDK classes to create application views. Discover how to use the camera, geolocation, gestures, and other device capabilities to create engaging, interactive apps. We'll develop stunning user interfaces faster with the XCode interface builder and make web apps by using WebView. We'll then augment applications with RubyMotion gems, doing more by writing less code and learn how to write test cases for RubyMotion projects. Finally, we'll understand the app submission process to push your app to Apple's App Store With "RubyMotion iOS Development Essentials", we will learn how to create iOS apps with ease. At the end of each chapter we will have a tangible and running app, which utilizes the concepts we have learnt in that chapter.
Table of Contents (19 chapters)
RubyMotion iOS Development Essentials
About the Authors
About the Reviewers

Some more goodies

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:

  1. Create a file root_controller.rb in the app folder and add the following code:

    class RootController < UIViewController...