2010-07-05 2 views
0

내 테이블 뷰 및 스레드 데이터에 문제가 있습니다. 내 애플 리케이션 메신저에 이미지 데이터를 포함하여 XML에서 데이터를 다운로드하는 인스턴트 메신저 내 tableviews에 대한 이미지를 얻기 위해 파싱.스레드 데이터에 비동기 이미지 문제

메신저는 asyncimageview 클래스 (markj.net)를 사용합니다. 내 XML의 다운로드 스레드를 누른 다음 스레드가 dequeued 및 다시로드 될 때까지 이미지가로드되지 않는 appart 형식의 셀이 잘 표시되는 realoadData가 있고이를 수정하는 방법을 알지 못합니다.

도움주세요 .....

+0

이 cellForRowAtIndexPath에서 관련 코드를 게시하시기 바랍니다 사용하여 메인 스레드에서 호출합니다. – warrenm

답변

0

제가

- (void)loadImagesForVisibleCells; 

{ 있는 NSArray를 사용하여 고정하는 관리 확인 셀 = self.newsStories visibleCells]; [셀 유지]; for (int i = 0; i < [셀 수]; i ++) { // 배열의 각 셀로 이동하고 해당 셀에 응답하는 경우 해당 loadContent 메서드를 호출합니다. CGRect 프레임; frame.size.width = 75; frame.size.height = 75; frame.origin.x = 0; frame.origin.y = 0; AsyncImageView asyncImage = [[[AsyncImageView alloc] initWithFrame : frame] autorelease]; 방법 :

//AsyncImageView *asyncImage = (AsyncImageView *)[[cells objectAtIndex: i] retain]; 
    //*flickrCell = (FlickrCell *)[[cells objectAtIndex: i] retain]; 
    NewcastleStories *aStory = [stories objectAtIndex:i]; 
    //AsyncImageView* asyncImage = [[AsyncImageView alloc]init]; 
    [asyncImage emptyImages]; 

    NSURL* url =[NSURL URLWithString:aStory.picture]; 
    [asyncImage loadImageFromURL:url]; 
    //[cells objectAtIndex:i]) 
    static NSString *CellIdentifier = @"ImageCell"; 
    UITableViewCell *cell = [newsStories dequeueReusableCellWithIdentifier:CellIdentifier]; 

    [cell.contentView addSubview:asyncImage]; 
    [[self newsStories]setNeedsLayout]; 
    [[self newsStories] setNeedsDisplay]; 
    //[self dataLoaded]; 
    //[asyncImage loadImage]; 
    //[flickrCell release]; 
    //flickrCell = nil; 
} 
[cells release]; 

}

있지만이는

[self performSelectorOnMainThread:@selector(loadImagesForVisibleCells) withObject:nil waitUntilDone:YES];