3つの異なる情報の配列を読み込む3つの異なるテーブルビューを実装しようとしています フォーラムでは、.tagを使用してテーブルを区別し、条件を使用してデータを読み込むことができます、 私は、私のテーブルにXIBのアイデンティティ/名前のテーブル の名前を変更異なるデータを持つipadの3つのテーブル
を を試してみましたが、他のアレイ を表示するには、セルの内容を変更する
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
//---try to get a reusable cell---
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
//---create new cell if no reusable cell is available---
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
/*
//---set the text to display for the cell---
NSString *cellValue = [listOfMovies objectAtIndex:indexPath.row];
cell.textLabel.text = cellValue; */
if (tableView.tag == 1) {
//Deal with table 1 - contains 5 sections
cell.textLabel.text = [array objectAtIndex:indexPath.row];
} else if (tableView.tag == 2) {
//Deal with table 2 - contains 1 section
cell.textLabel.text = [array2 objectAtIndex:indexPath.row];
}
// cell.textLabel.text = [array3 objectAtIndex:indexPath.row];
else {
cell.textLabel.text = [array objectAtIndex:indexPath.row];
}
return cell;
}
を使用していないが、働いている(ロングショット!) 私のテーブルのためにこの.tagを定義する方法 また、私は行(カウント)とセクション1のために同じようにしたい すべてのテーブルのために 私はちょうどそれらのように残すか? 私は現在、同じ配列を示す3つのテーブルを持っています
ありがとうございました!
私はちょうど(私の他の配列を表示するために)2のための任意のテーブルのためのXIB(ビュー/タグ)、例えばタグに0を変更する場合は、私がキャッチされない例外によりにアプリを終了>取得'NSRangeException'、理由: '*** - [NSCFArray objectAtIndex:]:インデックス(1)を越えて境界(1)' – MaKo