I have UIImageView inside UIScrollView. UIImageView displays image which is constantly downloaded from the internet (stream opened by using NSURLConnection).
NSString surl = @"some valid url";
NSURL* nsurl = [NSURL URLWithString:surl];
NSURLRequest *request = [NSURLRequest requestWithURL:nsurl];
[[NSURLConnection alloc] initWithRequest:request delegate:self];
// this method will be called when every chunk of data is received
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
// here I collect data and when i have enough
// data to create UIImage i create one
}
Every time I receive data I pack it into a NSData and when I receive whole image I create UIImage from this NSData and then I set this image as image of UIImageView. Everything works fine, image updates as it should but when I touch screen and start to move content around (this UIImageView is always bigger than the screen and UIScrollView always fit whole screen) image updates stop and I see only last frame that was displayed at the time i clicked. This seems to be happening because my
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
stops being called. After releasing my finger from the screen method again receives data and image updates as it should. I have no idea why my NSURLConnection delegate method stops receiving data. Any help?