Hi all,
I have this snippet from apple sample code "LazyTableImages" . In the code below they are initializing the IconDownloader class . So what kind of behavior is this .
*************************This Line ******************************************
IconDownloader *iconDownloader = [imageDownloadsInProgress objectForKey:indexPath];
**************************************************************************
and then
if (iconDownloader == nil)
{
iconDownloader = [[IconDownloader alloc] init];
iconDownloader.CustomObject = CustomObject;
iconDownloader.indexPathInTableView = indexPath;
iconDownloader.delegate = self;
[imageDownloadsInProgress setObject:iconDownloader forKey:indexPath];
[iconDownloader startDownload];
[iconDownloader release];
}
and the objectForKey docs says this :
objectForKey:
Returns the value associated with a given key.
- (id)objectForKey:(id)aKey
Parameters
aKey
The key for which to return the corresponding value.
Return Value
The value associated with aKey, or nil if no value is associated with aKey.
Availability
* Available in iPhone OS 2.0 and later.
So should I believe they are setting this line
IconDownloader *iconDownloader = [imageDownloadsInProgress objectForKey:indexPath];
just for setting the nil value in the object .
ultimately the question is what does the above line do ?
thanks