It sounds a bit strange, but since i use a spinning wheel indicator, the lazy image load don't works for the first image views (these once that are shown in the first screen). If the user scrolls down all other Images in the TableView loading correctly by a lazy download.
The main problem is, that NSURLConnection
didn't calls didReceiveData
.
- (void)startDownload
{
self.activeDownload = [NSMutableData data];
BOOL firstCell = (self.indexPathInTableView.row==0 && self.indexPathInTableView.section==0);
if(firstCell){
NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:
[NSURLRequest requestWithURL:
[NSURL URLWithString:newsContent.title_picture]] delegate:self];
NSLog(@"Get Title Pic %@ (%@)",newsContent.title, newsContent.title_picture);
self.imageConnection = conn;
}else{
NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:
[NSURLRequest requestWithURL:
[NSURL URLWithString:newsContent.cover_picture]] delegate:self];
NSLog(@"Get Thumb Pic %@ (%@)",newsContent.title, newsContent.cover_picture);
self.imageConnection = conn;
}
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
NSLog(@"[NewsPicture][connection]didReceiveData");
[self.activeDownload appendData:data];
}
Edit: Added didReceiveResponse
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
NSLog(@"[NewsPicture][connection]didReceiveResponse");
}
I'll get the Log "Get Thumb Pic ... (...)" with a correct Url, but for the for the first 5 rows (they fills the screen of an iPhone 4) i don't get the Log "[NewsPicture][connection]didReceiveData".
This is the way how i call the Indicator:
// Spinning Wheel
HUD = [[MBProgressHUD alloc] initWithView:self.view];
HUD.tag = 1000;
[self.view addSubview:HUD];
HUD.delegate = self;
HUD.labelText = @"wird geladen";
HUD.minShowTime = 25;
HUD.dimBackground = YES;
[HUD show:true];
[HUD showWhileExecuting:@selector(doWhileLoadingNews) onTarget:self withObject:nil animated:NO];
and if i only call
[self doWhileLoadingNews];
at this place all works fine, but without in indicator for loading data.
How could i fix it? (I can post more Code oder Informations if you need)
Edit: I still couldn't fix it. Is it possible to catch the result in another way then calling the 'didReceiveData'?
Edit: Added didReceiveResponse
but with the same result, didReceiveResponse
is also not called.