Chapter 5. Becoming a Capable Control Freak

Controls are the way mobile users do things with their devices, such as pressing buttons, choosing items from option lists, and navigating among tabs. One of Titanium’s great advantages in comparison with some other environments that produce native apps is that Titanium uses native controls. When you ask Titanium for a button, the button that an iPhone user gets is the same button that a native app would use, and so on. This is a win-win-win situation, for the following reasons:

  • Users running your app see and interact with native controls in the ways they are accustomed to. So on iOS, a slider looks like the same native slider users see in other apps, whereas Android users see an “Android” slider. This makes users more comfortable using the app, and ensures that the control supports all the features they expect.

  • Using native controls saves you the trouble of rebuilding them in HTML5/CSS/JavaScript. HTML5/CSS is a powerful combination and gives you incredible control over the UI, and it’s possible to create user controls in HTML5/CSS. But it’s also a lot of work, whereas Titanium lets you create a native control with a single line of code.

  • Native controls perform better and require less device resources to render and interact with. They are compiled components, so they run much more efficiently than anything you can create in HTML. Remember that anything in HTML has to run through a web browser, chromeless or not, and this is a very “heavy” ...

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.