Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<ol> <li><p><code>UIImage *picture = [[UIImage alloc] init];</code> and <code>picture = UIGraphicsGetImageFromCurrentImageContext();</code> You should not initialize <code>picture</code> at the beginning of the code. <code>UIGraphicsGetImageFromCurrentImageContext</code> returns a already initialized <code>UIImage</code> (autoreleased).</p></li> <li><p><code>UIImage *payload = [[UIImage alloc] initWithData:self.activeDownload];</code>, <code>picture = payload;</code>, <code>[payload release];</code>. You should use <code>[payload autorelease]</code> instead, otherwise you're releasing the image without ever using it.</p></li> <li><p><code>[delegate ThumbDidLoad:self.indexPathInTableView Image:[picture autorelease]];</code> You should remove <code>[picture autorelease]</code> and just use <code>picture</code>.</p> <pre><code>-(void)connectionDidFinishLoading:(NSURLConnection *)connection{ UIImage *payload = [[UIImage alloc] initWithData:self.activeDownload]; UIImage *picture; if (payload.size.width != kAppIconHeight &amp;&amp; payload.size.height != kAppIconHeight) { CGSize itemSize = CGSizeMake(kAppIconHeight, kAppIconHeight); UIGraphicsBeginImageContext(itemSize); CGRect imageRect = CGRectMake(0.0, 0.0, itemSize.width, itemSize.height); [payload drawInRect:imageRect]; picture = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); } else { picture = payload; } [payload autorelease]; self.activeDownload = nil; self.imageConnection = nil; [delegate ThumbDidLoad:self.indexPathInTableView Image:picture]; } </code></pre></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload