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.

Get Appcelerator Titanium: Up and Running now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.