Titanium で iPhone アプリケーションを開発しており、特定のTableViewSectionに行を追加する必要があります。アプリケーションのライフサイクル全体でユーザーによって動的に行われるため、ページの読み込み時にこれを行うことはできません。ドキュメントには、TableViewSection にadd
は 2 つの引数を取るメソッドがあると書かれていますが、機能させることはできません。これが私の既存のコードです:
for(var i = 0; i <= product_count; i++){
productsTableViewSection.add(
Ti.UI.createTableViewRow({
title:'Testing...'
})
);
}
これは 1 つの引数を渡すだけであり、Titanium はキャッチされない例外で終了します。
2010-04-26 16:57:18.056 MyApplication[72765:207] *** Terminating app due to uncaught
exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in
section 2. The number of rows contained in an existing section after the update (2) must be
equal to the number of rows contained in that section before the update (1), plus or minus the
number of rows inserted or deleted from that section (0 inserted, 0 deleted).'
2010-04-26 16:57:18.056 MyApplication[72765:207] Stack: (
例外は行を追加したように見えますが、何らかの理由で許可されていません。ドキュメントにはTableViewSection
、「ビュー」と「行」を取り込むと記載されているため、次のことを試しました。
for(var i = 0; i <= product_count; i++){
productsTableViewSection.add(
Ti.UI.createView({}),
Ti.UI.createTableViewRow({
title:'Testing...'
})
);
}
上記のコードは例外をスローしませんが、次のようになります[WARN]
。
[WARN] Invalid type passed to function. expected: TiUIViewProxy,
was: TiUITableViewRowProxy in -[TiUITableViewSectionProxy add:] (TiUITableViewSectionProxy.m:62)
appendRow
TableViewSections は、 またはのようなメソッドをサポートしていないようですinsertRow
。そのため、他にどこに行くべきかわかりません。KitchenSink アプリを調べましたが、TableViewSection に行を追加する例は見つかりませんでした。どんな助けでも大歓迎です。