특정 테이블에서 이미지를 다운로드하도록 구문 분석 데이터베이스에 쿼리하고 있습니다. 내가 생각하는 것이 결함 인 것을 제외하고는 모든 것이 작동하고 있습니다.이미지가 아래로 스크롤 될 때까지 TableViewCells에 표시되지 않습니다.
이미지는 UITableView
을 약간 스크롤 할 때만 나타납니다.
예 이미지를 비동기식으로 다운로드하고 있습니다.
건배
UPDATE 이미지가 메모리를 많이 사용하는 경우 내가
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Post";
FeedPhotoCell *feedPhotoCell = (FeedPhotoCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
WallImage *wallImage = [DataStore instance].wallImages[indexPath.row];
[feedPhotoCell.photoPost setImage:wallImage.image];
NSString *facebbokUserID = wallImage.fbID;
NSString *urlString = [NSString stringWithFormat:@"https://graph.facebook.com/%@/picture?type=large",facebbokUserID];
NSURL *facebookProfilePicURL = [NSURL URLWithString:urlString];
[feedPhotoCell.profilePhoto setImageWithURL:facebookProfilePicURL];
feedPhotoCell.profilePhoto.layer.cornerRadius = 10.0;
feedPhotoCell.profilePhoto.layer.borderColor = [UIColor orangeColor].CGColor;
feedPhotoCell.profilePhoto.layer.borderWidth = 1.0;
feedPhotoCell.profilePhoto.clipsToBounds = YES;
NSLog(@"image cell height: %f", feedPhotoCell.photoPost.image.size.height);
return feedPhotoCell;
}
가능한 경우 이미지를 다운로드하고 표시하는 데 사용하는 코드를 제공하는 것이 도움이됩니다. – Brian
배경 스레드에 이미지를 설정하는 것처럼 들립니다. 'imageView.image = ... '를 주 스레드에 보내서 테이블 뷰가 다시 그려지기 전에 변경 사항을 적용해야 할 수도 있습니다. – Eagerod
나는 당신이 말한대로 그것을 고쳤습니다. cellForRowAtIndex에서 이미지를 다운로드하기 시작하고 응답이 오면 이미지를 메인 스레드에로드합니다. 감사합니다. – Camus