In last week's episode, we created a cross-platform Navigation Controller as a custom component we could use to organize windows in a Titanium application. This week, we will be taking a deeper look at how to extend core Titanium objects and create our own custom UI components.

In order to accomplish this, we will be using a technique popularized by JavaScript luminary Douglas Crockford, which is called parasitic inheritance. Parasitic inheritance takes advantage of the malleable nature of JavaScript objects, allowing a developer to create an instance of a given type, modify it with additional properties, and return it as a new type of object.

This is a very powerful technique in JavaScript applications generally, but is even more useful and powerful when dealing with JavaScript proxy objects in Titanium. We can use factory functions in the Ti.UI namespace to create base UI components, and then extend those components with new features and functionality we define ourselves.

Find out how use this technique to create a custom ratings widget in this week's episode of Forging Titanium.

Episode Resources:

Douglas Crockford on inheritance in JavaScript: crockford.com/javascript/inheritance.html

Icon set used for star widgets: wefunction.com/2008/07/function-free-icon-set/

Forging Titanium GitHub repository: github.com/appcelerator-developer-relations/Forging-Titanium

Loading more stuff…

Hmm…it looks like things are taking a while to load. Try again?

Loading videos…