Hihi all,
I have implement a mechanism for the above (in the question title), this is how it works:
- Create an NSURLConnection and make a call to my json webservice to get a list of records with the image URL for each of the record.
- In the connectionDidFinishLoading delegate, I set the returned records to my NSArray and reload my UITableView with the NSArray, but I don't load the image at this point.
- In the same connectionDidFinishLoading delegate, for each of the retrieved record, I fire off separate connection to get the image data. Imagine I have 5 records returned from the previous json webservice, I will fire off 5 GET requests to get my image data for each of the records.
- Then this time round, in the connectionDidFinishLoading delegate, I will know this time it is fired from the request of getting image data, I will set the image data into my NSArray of my UITableView datasource and do a reloadData. For 5 records, the table will be reloaded 5 times.
- Everything seems working fine only if I do not reload the last 2 elements of my NSArray, otherwise, I will hit the exc_bad_access exception.
Appreciate your kind advice. This might be a foolish way of doing thing.
:)