0

ここで、tableViewに問題があります。テーブルの各行にテキストを挿入したい

手伝ってくれませんか

これがコードです

// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('white');

// create tab group
var tabGroup = Titanium.UI.createTabGroup({ 

});

// create base UI tab and root window

var win1= Titanium.UI.createWindow({ 

    title:'',
    tabBarHidden: true,
    barColor:'black',
    backgroundColor:'white'
});


var tab= Ti.UI.createTab({
    title:'Connexion ',
    window:win1

});

//
//  This is a test that is meant to verify that a row object can have a header
//  and the table view has no table view header - the header should be displayed

var win = Titanium.UI.currentWindow;

var inputData = [
    {title:'Pseudo/email :', header:'Connexion ......'},
    {title:'Password :'},

    {title:'Créer votre compte',hasChild:true, header:'not yet registered ?'},

];
var tableView = Titanium.UI.createTableView({
    data:inputData,
    style:Titanium.UI.iPhone.TableViewStyle.GROUPED
});
win1.add(tableView);

tabGroup.addTab(tab);

// open tab group-----------------------------------------
tabGroup.open();
win1.open();

それは私が今やったことですが、テーブルのタイトルに問題があり、別のテーブルを追加します。

中央のタイトルで移動するカーソルを持ついくつかのouciもあります

これがコードです

var win1= Titanium.UI.createWindow({ 

    title:'',
    tabBarHidden: true,
    barColor:'black',
    backgroundColor:'white'
});


    var view = Titanium.UI.createView({
        backgroundColor: "#FFFEEE"
    });


    var row1 = Ti.UI.createTableViewRow({
        height:'auto',
        selectionStyle:Ti.UI.iPhone.TableViewCellSelectionStyle.NONE
    });


    var label1 = Titanium.UI.createLabel({
        text:'Pseudo/e-mail :',
        left: 10
    });


    var usernametf = Ti.UI.createTextField({
        left: 100,
        right:10,
        //hintText: 'Pseudo/email :',
    //textAlign:"right",
        borderStyle: Ti.UI.INPUT_BORDERSTYLE_NONE
    });


    var row2 = Ti.UI.createTableViewRow({
        height:'auto',
        selectionStyle:Ti.UI.iPhone.TableViewCellSelectionStyle.NONE
    });


    var label2 = Titanium.UI.createLabel({
    text:'Mot de passe :',
        left: 10       
    });

    var passwordtf = Ti.UI.createTextField({
        left: 100,
        //textAlign:"right",
        //hintText: 'password',
        right:30,
        passwordMask:true,
        borderStyle: Ti.UI.INPUT_BORDERSTYLE_NONE
    });

    row1.add(label1);

    row1.add(usernametf);

    row2.add(label2);

    row2.add(passwordtf);

    var data = [row1,row2];

    var table = Ti.UI.createTableView
    ({

    data:data,
    style: Ti.UI.iPhone.TableViewStyle.GROUPED

    });


    view.add(table);

    win1.add(view);

win1.open();

私は本当にAppceleratorから始めたことをお知らせします

4

1 に答える 1

0

テキストフィールドだけを使用しない理由はありますか?次に、ボタンを押して挿入するだけで値を取得できます。

キッチンシンクのサンプルリンク https://github.com/appcelerator/titanium_mobile/blob/master/demos/KitchenSink/Resources/examples/textfield_events.js

このような画面の別の例は、Tweetaniumアプリhttps://github.com/appcelerator/tweetaniumです。

テキストフィールドとテーブルビューのどちらを使用する場合でも、Tiデータベースオブジェクトを操作する方法はいくつかあります。

2つの一般的な方法は次のとおりです。

1)inputDataオブジェクトをループして挿入できます。以下はいくつかの例です。

https://github.com/appcelerator/titanium_mobile/blob/master/demos/KitchenSink/Resources/examples/database_2.js

https://github.com/appcelerator/titanium_mobile/blob/master/demos/KitchenSink/Resources/examples/database_3.js

2)テーブルビューオブジェクト自体、またはこの例のようなラッパーを使用できますhttps://github.com/kwhinnery/Persistence

可能であれば、テキストフィールドを使用することをお勧めします。

于 2011-04-27T13:01:46.143 に答える