i'amは、 - 第1部はscrollview WIDイメージの を含む細胞を含む - - 私は2つのセクション を持つテーブルのビューを有する第2の部分は含まれて拡張可能な細胞を含みますスクロールビューの画像は でしたので、問題は です。テーブルの一番下のセルが最初のセルが展開されたときのように、dequereusableの奇妙な振る舞いを表示すると、 のようになりました。 がうまく動作し始めましたが、ビューに表示されていないセルをスクロールした後に画像を追加したときに、その画像が更新されました。 そうdequeueReusableCell奇妙な行動を引き起こす
をロードするために多くの時間をakingは親切 下記のコード で賢くキューを使用する方法を私を導く可能性 - (UITableViewCellの*)のtableView:(のUITableView *)のtableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{[ここで別の名前が再利用識別子のために使用されている]
NSString *[email protected]"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell== nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"hai"] autorelease];
///; ////
あなたはセルをデキュー前に、代替の再利用識別子 を設定する必要が if ([self tableView:tableView inSection2:indexPath.section]) {
Coffee *co =[appDelegate.coffeeArray2 objectAtIndex:indexPath.section-s1Count-1];
cell.textLabel.text=co.coffeeName;
}
if ([self tableView:tableView inSection1:indexPath.section]) {
Coffee *co =[appDelegate.coffeeArray1 objectAtIndex:indexPath.section];
cell.textLabel.text = co.coffeeName;
CGRect cellname = CGRectMake(5, 0, 290, 25);
UILabel *cellabel = [[[UILabel alloc] initWithFrame:cellname] autorelease];
cellabel.backgroundColor = [UIColor whiteColor];
cellabel.font = [UIFont italicSystemFontOfSize:20];
cellabel.textColor=[UIColor blueColor];
cellabel.highlightedTextColor = [UIColor clearColor];
cellabel.text=co.coffeeName;
[cell.contentView addSubview:cellabel];
}
// Configure the cell...
if ([self tableView:tableView canCollapseSection:indexPath.section])
{
if (!indexPath.row)
{
// first row
// only top row showing
if ([expandedSections containsIndex:indexPath.section])
{
cell.accessoryView = [myuicontroller accessoryWithColor:[UIColor grayColor] type:DTCustomColoredAccessoryTypeUp];
}
else
{
cell.accessoryView = [myuicontroller accessoryWithColor:[UIColor grayColor] type:DTCustomColoredAccessoryTypeDown];
}
}
else
{
// all other rows
cell.accessoryView = nil;
cell.accessoryType =UITableViewCellAccessoryDisclosureIndicator;
CGRect cellname = CGRectMake(5, 0, 290, 25);
UILabel *cellabel = [[[UILabel alloc] initWithFrame:cellname] autorelease];
cellabel.backgroundColor = [UIColor whiteColor];
cellabel.font = [UIFont italicSystemFontOfSize:13];
cellabel.textColor=[UIColor blueColor];
cellabel.highlightedTextColor = [UIColor clearColor];
// cellabel.text =[NSString stringWithFormat:@"category"];
[cell.contentView addSubview:cellabel];
myscrollView *svb;
svb=[[myscrollView alloc]initwitharray:appDelegate.newscat1];
}else{
myscrollView *s;
NSLog(@"inside the textlabel ext%@",cell.textLabel.text);
NSLog(@"count of array %d",[appDelegate.newscat1 count]);
NSString *cat=cell.textLabel.text;
[cell.contentView addSubview:s];
}
}
return cell;
}
今、新しい問題があります。テーブルをリロードするときにデータソースの変更が反映されないのですが、デキューを削除すると、変更が反映されます。デキューの古いデータを削除する方法はありますか? –
新しい問題が発生した場合は、新しい質問をしてください。 – jrturton