1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

KitchenSinkのcontrols.js(Titaniumの勉強メモ)

Last updated at Posted at 2012-12-26

入門になったら、勉強がなかなか進まなくて、KitchenSinkのサンプルソースを追って勉強しようかと思っています。興味のある方は一緒に勉強しましょう。コミュニケーションの場になればなあと思います。

■ソースのURL:
https://github.com/appcelerator/KitchenSink/blob/master/Resources/main_windows/controls.js


// create table view data object
var data = [
	{title:'Slider', hasChild:true, test:'../examples/slider.js'},
	{title:'Switch', hasChild:true, test:'../examples/switch.js'},
	{title:'Activity Indicator', hasChild:true, test:'../examples/activity_indicator.js'},
	{title:'Progress Bar', hasChild:true, test:'../examples/progress_bar.js'},
	{title:'Button', hasChild:true, test:'../examples/button.js'},
	{title:'Button States', hasChild:true, test:'../examples/button_state.js'},
	{title:'Label', hasChild:true, test:'../examples/label.js'},
	{title:'Search Bar', hasChild:true, test:'../examples/searchbar.js'},
	{title:'Text Field', hasChild:true, test:'../examples/textfield.js'},
	{title:'Text Area', hasChild:true, test:'../examples/textarea.js'}
];

// add iphone specific tests
if (Titanium.Platform.name == 'iPhone OS')
{
	data.push({title:'Button Bar', hasChild:true, test:'../examples/buttonbar.js'});
	data.push({title:'Tabbed Bar', hasChild:true, test:'../examples/tabbedbar.js'});
	data.push({title:'System Buttons', hasChild:true, test:'../examples/system_buttons.js'});
	data.push({title:'Toolbar', hasChild:true, test:'../examples/toolbar.js'});
}
data.push({title:'Picker', hasChild:true, test:'../examples/picker.js'});

// create table view
var tableview = Titanium.UI.createTableView({
	data:data
});

// create table view event listener
tableview.addEventListener('click', function(e)
{
	if (e.rowData.test)
	{
		var win = Titanium.UI.createWindow({
			url:e.rowData.test,
			title:e.rowData.title
		});
		Titanium.UI.currentTab.open(win,{animated:true});
	}
});

// add table view to the window
Titanium.UI.currentWindow.add(tableview);


サンプルから勉強になった内容:

下記の内容を上記のソースから探すことが出来れば、上記のソースがもう理解できた証だと思います。後はどのように組み合わせて自分のソースの中に入れれば良いかを考えればよいと思います。

まとめ中。。。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?