2

I've the following problem :

I have a UIView containing a UIScrollView as a subview. (nib file). Programmatically I add several subviews (UIImageView) to the UIScrollView, each UIImageview contains an image loaded from the net asynchronously, so I need to update the scrollView when the images are downloaded. In the class responsible of the images fetching, I advertise the the View controller responsible to manage the scrollView, using this code

[[(MosaicViewController *)data] scrollView setNeedsDisplay];

the Ivar data is a pointer to the ViewController. This stuff don't work,no reload of the scrollView happen To be sure that the call is triggered I wrote a method inside the viewController containing the scrollView, and inside this method I called setNeedsDisplay,

[(MosaicViewController *)data updateView];

-(void) updateView
{
    NSLog(@"setNeedsDisplay");
    [self.scrollView setNeedsDisplay];
}

the method updateView is triggered correctly, I mean is called after each Image is downloaded, but the scrollView contents isn't updated. In the ViewController containing the scrollView I don't implement the drawRect method, could be this the reason for the lack of update after calling setNeedsDisplay?

Any help/suggestion/reference etc.. is welcome Thanks in advance

oiledCode
  • 8,589
  • 6
  • 43
  • 59

1 Answers1

-4

Dude are you doing imageView.image = downloadedImage ??

Also you should not have to do [self.scrollView setNeedsDisplay] since you did not change anything on scrollView !!

What changed is the content of the imageView and imageView.image = downloadedImage will automatically trigger setNeedsDisplay on imageView !!

Some other check points

Is scrollView visible? Is scrollView.contentSize set?? Is the scrollView frame correct ??

NSIntegerMax
  • 542
  • 2
  • 5