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 10. API Reference

As with any library, Titanium offers an integrated API that gives you access to the features it has to offer. The Titanium API is organized into several different namespaces, which are fairly self explanatory. For instance, UI components exist in the Titanium.UI namespace and can be invoked as Titanium.UIxxx.

When referring to Titanium methods and constants, Ti can be used instead of Titanium. So Ti.UI.createTableView is the same as Titanium.UI.createTableView.

The namespaces in this chapter range from fairly complex and full, such as the UI namespace, down to ones that have only a method or two. These namespaces also contain constants, which are JavaScript variables that cannot be changed and that have a fixed meaning that’s useful in programming with that namespace’s methods. Even though many times you need to look them up in the reference material, it’s easier to use something like Titanium.UI.iPhone.TableViewStyle.GROUPED than 234587923. Furthermore, if Titanium changes the definition of a constant, your code can be recompiled and still work without being rewritten.

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