O'Reilly logo

RubyMotion iOS Development Essentials by Abhishek Nalwaya, Akshat Paul

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

Device events

Most of the iOS applications make use of the various device capabilities. As a good practice, we must test these features to deliver high quality apps. RubyMotion gives us an environment to test some device capabilities. Let's discuss a few of them in this section.

Rotate device

We can test the rotation of the device by calling the following event:

rotate_device(:to => orientation, :button => location)

The rotate_device command allows us to pass the following two arguments:

  • to: This passes the orientation to rotate the device; it can either have portrait or landscape as a value.
  • button: The button here indicates the position of the home button; it makes sense if we pass the values based on the first value of orientation. In portrait mode, ...

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