“BizApp” Documentation by Rick Blalock v1.0


“BizApp”

Created: 10/25/2010
By: Rick Blalock


Requirements
Titanium 1.4.1.1
iOS 4+

The "BizApp" template is built for Titanium (current version as of this documentation is 1.4.1.1). The app template includes several tableView layouts, animation effects, and more, all ready to be plugged in. Please read the instructions below for further detail.

Don't forget to check the Titanium Dev Center for help with Titanium.


Setup

The easiest / best way to setup this template are as follows (Make sure you have the latest version of Titanium installed)

  1. Start by creating a new project in Titanium. (Make sure you are creating a mobile / iPhone app - not Desktop)
  2. Once the project is created enter in the details of your project under the "Edit" tab
  3. Look at the file location of your newly created project and you will find a folder called "Resources". This is the folder where all the javascript, images, etc. belong. Remove all files in the 'Resources' folder and Move the template files you received in your download to the project "Resources" folder.
  4. That's it! All you have to do is go to the 'Test & Package' page and launch the emulator and you're good to go.

About the App

The app is broken in to the following pages:


Helpful Tips

The template here makes extensive use of the tableView and tableViewRow APIs. If you have any questions as to what properties do I recommend looking through these API docs. I also tried to comment the code as much as possible to ease understanding in what's happening.

For the parts where tableViewRow is used you will want to loop through some of these sections, appending any data you have, whether it be from a remote data source or something local (like a SQLlite database). In the kitchen sink examples that come with Titanium you will see data being hardcoded in to an array. This is fine for simple use but if you're populating a tableView dynamically or if your layout is semi complex it's much better to use the tableViewRow object so you can control the elements of each row. EXAMPLE:

			// Start an empty array that the rows will be stored in
			var rows = [];
			
			// Pretend we're assigning a json feed result to this variable
			var data = SOME REMOTE SOURCE OF DATA HERE;
			
			// Loop through data and apply to each row
			for(var i = 0; i < data.length; i++) {
				var row = Titanium.UI.createTableViewRow({ 
					...stuff here...
				});

				var title = Titanium.UI.createLabel({ 
					... stuff here ...
				});
				
				...
				
				// add the row to the rows array
				rows.add(row);
			}	
			
			// Then at the end you'll have an array full of the rows of data you need
		

It's a good idea to give your tableViewRow a 'className' property as well. This helps iOS rendering of the layout. A good write up on this can be found in the TableView documentation.

It's best to separate out your app in to different classes (i.e. MVC-ish design). Because we use javascript for Titanium there are several ways to do this; use what you are comfortable with. For example: Using something like Mootool's Class methods (so you can extend and implement super classes) is very helpful. One thing to keep in mind: Any type of library that attempts to implement or manipulate the DOM will not work in Titanium since the DOM does not exist (except in webViews). So if you wanted to use, for instance, Mootool's helper methods for arrays, building classes, etc. you can use their build manager and select everything but the part of the library that uses the DOM. This is just one example of many. If you try to use JavascriptMvc, which uses jQuery, it will not work, because it relies heavily on DOM manipulation.

This app template is meant to be just that: a template. Just as if you purchased a template from ThemeForest a template will not help you code better or organize your code in to an MVC application. The purpose of this app template is to help you rapidly get started in building an app using Titanium. The code provided here can be copy-pasted in to any scenario that you have.

For advanced help on using Titanium, deploying an iPhone app, bugs, updates, etc. I highly recommend referencing the API docs and the forum over at appcelerator

If you have any questions related to the template itself don't hesitate to contact me on my blog.


Follow me on Twitter | Git Hub | Blog | Personal Projects | Hire my company

Built by Rick Blalock exclusively for Envato