5つのセクションがあるアプリケーションでTableViewを作成しました。iphone - UITableViewのスクロールの問題
セクション1〜4は1分ごとに1つの行のみを含み、セクション5は5行を含みます。
TableViewを画面からスクロールするまでは、すべて正常に機能します。私の最初のセクションと行(セル)には、UILabelにaccessoryViewが設定されています。
他のすべてのセルにはaccessoryTypeとして公開ボタンがあります。
テーブルビューをスクロールすると、最初のセルにあるテキストが何らかの形で最後のセルに表示されます!
NSStringを配列に追加してNSMutableArrayに辞書として追加してデータを設定しました。
そして、ここに私のセルが設定されている:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// UISwitch *aUISwitch = [[[UISwitch alloc]initWithFrame:CGRectZero]autorelease];
// Configure the cell.
NSDictionary *dictionary = [listOfSettings objectAtIndex:indexPath.section];
NSArray *array = [dictionary objectForKey:@"Settings"];
NSString *cellValue = [array objectAtIndex:indexPath.row];
cell.textLabel.text = cellValue;
if([cellValue isEqualToString:@"Status"]){
UILabel *viewLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 20)];
[viewLabel setText:@"Connected"];
cell.accessoryView = viewLabel;
[viewLabel release];
}
else{
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
}
return cell;
}
を私はこれはそれとは何かを持っていると推定して、彼らは画面をオフに行くときのセルが削除/削除されます知っていますか?画面外に出て再表示されるセルを処理するために推奨されるプラクティスは何ですか?
あなたに25ポイント! :) どうもありがとう! –