2011-02-09 8 views
0

こんにちは友人は、テーブルには10セルUIITabelViewCell間違ったイメージを表示する

を持っていますが、私はテーブルビューをスクロールすると、この画像を1にずつ来る2つだけのセル

上に画像を表示していますと言いますすべてのセル

私はここで間違っています。

静的NSString *識別子= @ "CellTypeLabel";

// create custom cell 
CustomizedTableCells* cell = nil; 
if (cell == nil) 
    cell = [[[CustomizedTableCells alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier] autorelease]; 

    // cell accessory type 
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 

cell.imageView.image = nil; 

NyhtrAppDelegate *appDelegate = (NyhtrAppDelegate *)[[UIApplication sharedApplication] delegate]; 
NSXMLElement* node = [appDelegate.items objectAtIndex:indexPath.row]; 
NSLog(@"\n Output :: %@ :: ", [node XMLString]); 

    // set the lable name for a cell 
if(node != NULL) 
{  
    int width = cell.contentView.bounds.size.width-50; 
    if([[[node elementForName:@"pubDate"] stringValue]length] > 0) 
     [cell setCellWithTitleAndSize:[[node elementForName:@"title"] stringValue] rect:CGRectMake(45, 0, width, 35) size: 17]; 
    else 
     [cell setCellWithTitleAndSize:@"N/A" rect:CGRectMake(45, 0, width, 35) size: 17];  
} 

NSXMLElement* iconElement = [self getIconElementForThisDomain:[self getDomain:node]]; 

NSString* iconImageUrl = nil; 
if (nil != iconElement) 
    iconImageUrl = [[iconElement elementForName:@"retina-icon"]stringValue]; 
else 
    iconImageUrl = @"http://nyhtr.se/icon/nyheter24.png"; 

// cached images  
NSString* imageName = [[UICachedImageMgr defaultMgr] imageNameFromURLString:iconImageUrl]; 
UIImageProxy* imageProxy = [UICachedImageMgr imageWithName:imageName userInfo:self]; 

cell.imageView.image = imageProxy.image;  

return cell;  
+0

不正な(おそらく)cellForRowAtIndexPath:メソッドがあります。コードを見て間違いを指摘する機会はありますか? – Vladimir

+0

あなたの質問を編集し、あなたのコードを入れてください...そして、このコードではどこの画像をセルに設定しますか? – Vladimir

+0

@Vladimir私はコード –

答えて

0

次の方法を確認し、セルのデキューを使用する場合は、あなたのデキューセルは、その中に画像とそれらのいずれかの可能性があり

 
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 
    //check the indexPath 
    if(indexPath.row==0 || indexPath.row==5){ 
    } 
    else{ 
    //other stuff 
    } 

} 
+0

を追加しました。あなたはこの方法でマニッシュをすることができます! –

0

のみ一致indexpath.row整数値に画像を追加します。

セルがデキューされている場合は、イメージが存在するかどうかを確認して削除する必要があります。

関連する問題