O'Reilly logo

Appcelerator Titanium: Up and Running by John Anderson

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

Chapter 6. Titanium Objects

Now that we’ve seen some of what Titanium can do, let’s take a look at some of what’s running things behind the scenes. iOS and Android platforms are very object-oriented, with everything in the app represented as one object or another.

Many objects share common properties and methods. Titanium has a number of base objects (the View being the most frequently inherited from) that all the other objects are based on. This allows you to know what kind of properties, methods, etc. are available on an object that is based on a view. For instance, a view has width and height properties. Since a button is based on a view, then a button also has width and height properties. At a UI level, most objects have these common properties and make it easier to know what you can do with a given object.

App Object

The App object is a good one to start with because it gives you access to things that happen at the “App” level. It represents the currently running app, and serves as a namespace that is available to any process running in any window in the app. This means that an event handler anywhere in the app can always access the App object. Depending on how you set up your namespace in your app, this may or may not be true of JavaScript objects that you create.

The App object contains interfaces to some very useful functions, such as the ability to store app-related data easily, capture events when the app goes into the background and comes back into the foreground, fire local ...

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