1

phonegap は初めてです。現在、Lion Mac で phonegap2.0 を使用しています。私のxcodeのバージョンは4.3です。今、htmlを使用してiPhoneアプリ用のTableviewを作成しました。そして、JavaScriptを使用していくつかの値を持つ配列を作成しました。以下のリンクを参照してください: この下のリンクでは、html ファイルと Javascript ファイルを添付しています。

"http://pastie.org/4779045"

今、テーブルビューに配列値をロードしたいと思います。この問題をロードするのを手伝ってください。

4

1 に答える 1

2

これがサンプルコードです

HTML 部分:

<!--HTML code -->
<ul data-role="listview" data-inset="true" id="lstMyList">
</ul>

Javascript

/*javascript code*/
var i;
var names= new Array();
names[0] = "Gopi";
names[1] = "Vinoth";
names[2] = "Yuvaraj";

for (i=0;i<names.length;i++){
    $('#lstMyList').append('<li><a href="#">'+names[i]+'</a></li>');//append list items to the list view dynamically 
}
//If you add items to a listview, you'll need to call the refresh() method on it to update the styles and create any nested lists that are added.
$('#lstMyList').listview("refresh");

あなたにとって明確であることを願っています。

于 2012-09-25T08:40:31.997 に答える