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.
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
: Thebutton
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, we can opt for the:bottom
or:top button
location. In landscape mode, we can opt for:left
or:right
with respect to the button location, for example,rotate_device
:to
=>:portrait
,:button
=>:bottom
.
This device event will rotate...