2011-02-09 3 views
0

안녕 친구 내가 테이블보기를 스크롤 할 때이 이미지가 하나 하나 오는 표는 10 세포UIITabelViewCell 잘못 표시되는 이미지 테이블 셀에 내가 이미지를 표시하고

을 가지고 있지만 난 두 세포

에 이미지를 표시하고 말한다 모든 셀

그래서 내가 여기서 잘못하고 있습니다.

정적 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 일치하는 이미지를 추가, 당신의 대기열 셀은 그 안에 이미지와 그 중 하나가 될 수 있습니다.

셀이 대기열에서 제외 된 경우 이미지가 있는지 확인하고 제거해야합니다.

관련 문제