入門になったら、勉強がなかなか進まなくて、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);
サンプルから勉強になった内容:
下記の内容を上記のソースから探すことが出来れば、上記のソースがもう理解できた証だと思います。後はどのように組み合わせて自分のソースの中に入れれば良いかを考えればよいと思います。
まとめ中。。。