I am trying to display the image in a UIScrollView and therefore need to update the contentsize and the bounds of the imageview to the actual size of the image being loaded.
I have implemented the [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(imageLoaded:) name:AsyncImageLoadDidFinish object:nil];
and in this method imageLoaded I am trying to update the frame of the imageview.
The problem is that sometimes it updates, and sometimes not (i. e. sometimes the bounds stay the same as the dummy image's).
Since the images are loaded from the outside, their dimensions are often not known. Perhaps you could suggest how the holding view frame could be updated to match the size of the downloaded image?
Sorry I didn't reply sooner, I somehow missed your comment. You can monitor when the image property is set using KVO (Key Value Observing) and the set the image frame to match the image.size.
Hi,
I am trying to display the image in a UIScrollView and therefore need to update the contentsize and the bounds of the imageview to the actual size of the image being loaded.
I have implemented the [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(imageLoaded:) name:AsyncImageLoadDidFinish object:nil];
and in this method imageLoaded I am trying to update the frame of the imageview.
The problem is that sometimes it updates, and sometimes not (i. e. sometimes the bounds stay the same as the dummy image's).
Since the images are loaded from the outside, their dimensions are often not known. Perhaps you could suggest how the holding view frame could be updated to match the size of the downloaded image?
Andrius