У меня есть этот фрагмент кода Apple с примером "LazyTableImages".В приведенном ниже коде они инициализируют класс IconDownloader.Так что же это за поведение.
*************************This Line ******************************************
IconDownloader *iconDownloader = [imageDownloadsInProgress objectForKey:indexPath];
**************************************************************************
, а затем
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];
}
, и документы objectForKey говорят:
objectForKey:
Возвращаетзначение, связанное с данным ключом.
- (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.
Поэтому я должен верить, что они задают эту строку
IconDownloader *iconDownloader = [imageDownloadsInProgress objectForKey:indexPath];
только для установки значения nil в объекте.
в конечном итоге вопрос в том, что делает приведенная выше строка?
спасибо