<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Resize/Scale of an Image &#8211; Take 1 &#8211; Using an Objective-C Category</title>
	<atom:link href="http://MobileDeveloperTips.com/graphics/how-to-scale-an-image-using-an-objective-c-category.html/feed" rel="self" type="application/rss+xml" />
	<link>http://MobileDeveloperTips.com/graphics/how-to-scale-an-image-using-an-objective-c-category.html</link>
	<description>iOS and Objective-C Tips, Tricks and Tutorials.</description>
	<lastBuildDate>Sat, 19 May 2012 05:15:17 -0500</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Nicolas Embleton</title>
		<link>http://MobileDeveloperTips.com/graphics/how-to-scale-an-image-using-an-objective-c-category.html#comment-67552</link>
		<dc:creator>Nicolas Embleton</dc:creator>
		<pubDate>Fri, 24 Feb 2012 17:26:18 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=4576#comment-67552</guid>
		<description>Wow, that is really cool. Very clever and handy way to scale images! I adopt it :)</description>
		<content:encoded><![CDATA[<p>Wow, that is really cool. Very clever and handy way to scale images! I adopt it :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ricard.perez</title>
		<link>http://MobileDeveloperTips.com/graphics/how-to-scale-an-image-using-an-objective-c-category.html#comment-59642</link>
		<dc:creator>ricard.perez</dc:creator>
		<pubDate>Mon, 05 Sep 2011 08:49:33 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=4576#comment-59642</guid>
		<description>Thanks a lot! I was looking just for this and I&#039;m still a nooby in CoreGraphics.</description>
		<content:encoded><![CDATA[<p>Thanks a lot! I was looking just for this and I&#8217;m still a nooby in CoreGraphics.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BlackBook</title>
		<link>http://MobileDeveloperTips.com/graphics/how-to-scale-an-image-using-an-objective-c-category.html#comment-57626</link>
		<dc:creator>BlackBook</dc:creator>
		<pubDate>Wed, 10 Aug 2011 08:13:31 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=4576#comment-57626</guid>
		<description>Thanks for sharing this useful post!</description>
		<content:encoded><![CDATA[<p>Thanks for sharing this useful post!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bruno</title>
		<link>http://MobileDeveloperTips.com/graphics/how-to-scale-an-image-using-an-objective-c-category.html#comment-50764</link>
		<dc:creator>Bruno</dc:creator>
		<pubDate>Fri, 27 May 2011 15:46:47 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=4576#comment-50764</guid>
		<description>Does this method will use the same amount of memory if I load a &#039;thumbnail&#039; from the image that I want to resize?</description>
		<content:encoded><![CDATA[<p>Does this method will use the same amount of memory if I load a &#8216;thumbnail&#8217; from the image that I want to resize?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Slava</title>
		<link>http://MobileDeveloperTips.com/graphics/how-to-scale-an-image-using-an-objective-c-category.html#comment-38606</link>
		<dc:creator>Slava</dc:creator>
		<pubDate>Tue, 25 Jan 2011 09:56:04 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=4576#comment-38606</guid>
		<description>Really laconic and nice code. Thank you very much.</description>
		<content:encoded><![CDATA[<p>Really laconic and nice code. Thank you very much.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://MobileDeveloperTips.com/graphics/how-to-scale-an-image-using-an-objective-c-category.html#comment-11361</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Thu, 18 Mar 2010 04:22:44 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=4576#comment-11361</guid>
		<description>Of course! I did go back and review memory management to see where my misunderstanding was. I ended up adding the retain and then an autorelease so that the caller doesn&#039;t have to worry about releasing it:

- (UIImage *) getImageForIndex:(NSIndexPath *)indexPath {
   ...
   image = [image scaleToSize:CGSizeMake(80.0f, 100.0f)];
   [image retain];
   return [image autorelease];
}

This clears up the problem in Instruments. Thanks!</description>
		<content:encoded><![CDATA[<p>Of course! I did go back and review memory management to see where my misunderstanding was. I ended up adding the retain and then an autorelease so that the caller doesn&#8217;t have to worry about releasing it:</p>
<p>- (UIImage *) getImageForIndex:(NSIndexPath *)indexPath {<br />
   &#8230;<br />
   image = [image scaleToSize:CGSizeMake(80.0f, 100.0f)];<br />
   [image retain];<br />
   return [image autorelease];<br />
}</p>
<p>This clears up the problem in Instruments. Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Muchow</title>
		<link>http://MobileDeveloperTips.com/graphics/how-to-scale-an-image-using-an-objective-c-category.html#comment-11307</link>
		<dc:creator>John Muchow</dc:creator>
		<pubDate>Wed, 17 Mar 2010 13:01:22 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=4576#comment-11307</guid>
		<description>Brian, have you tried to retain the image before returning it ?</description>
		<content:encoded><![CDATA[<p>Brian, have you tried to retain the image before returning it ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://MobileDeveloperTips.com/graphics/how-to-scale-an-image-using-an-objective-c-category.html#comment-11277</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Wed, 17 Mar 2010 05:04:53 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=4576#comment-11277</guid>
		<description>This is works great but I have showing memory leaks in Instruments when I call this code. But maybe it is the way I call it:

- (UIImage *) getImageForIndex:(NSIndexPath *)indexPath {
	
	NSInteger row = [indexPath row];
	NSInteger section = [indexPath section];
	
	CSLewisTriviaAppDelegate *appDelegate = (CSLewisTriviaAppDelegate *)[[UIApplication sharedApplication] delegate];
	NSDictionary *itemAtIndex = (NSDictionary *)[[appDelegate dataController] objectInCategoryArrayAtIndex:section];
	NSString *categoryName = [itemAtIndex objectForKey:@&quot;name&quot;];
	Resources *tempResourcesObject = [[appDelegate dataController] returnResourcesObject];
	
	NSDictionary *bonusInfoLinksResourceDict = [tempResourcesObject getResourceImageAndTitle:categoryName row:row];
	
	NSDictionary *resourceDictionary = [self returnResourceDictionary:bonusInfoLinksResourceDict indexPath:indexPath];
	
	// nothing found
	if (resourceDictionary == nil) {
		return nil;
	}
	
	UIImage *image = [UIImage imageNamed:[resourceDictionary objectForKey:@&quot;image&quot;]];
	image = [image scaleToSize:CGSizeMake(80.0f, 100.0f)];
	
	return image;
}</description>
		<content:encoded><![CDATA[<p>This is works great but I have showing memory leaks in Instruments when I call this code. But maybe it is the way I call it:</p>
<p>- (UIImage *) getImageForIndex:(NSIndexPath *)indexPath {</p>
<p>	NSInteger row = [indexPath row];<br />
	NSInteger section = [indexPath section];</p>
<p>	CSLewisTriviaAppDelegate *appDelegate = (CSLewisTriviaAppDelegate *)[[UIApplication sharedApplication] delegate];<br />
	NSDictionary *itemAtIndex = (NSDictionary *)[[appDelegate dataController] objectInCategoryArrayAtIndex:section];<br />
	NSString *categoryName = [itemAtIndex objectForKey:@"name"];<br />
	Resources *tempResourcesObject = [[appDelegate dataController] returnResourcesObject];</p>
<p>	NSDictionary *bonusInfoLinksResourceDict = [tempResourcesObject getResourceImageAndTitle:categoryName row:row];</p>
<p>	NSDictionary *resourceDictionary = [self returnResourceDictionary:bonusInfoLinksResourceDict indexPath:indexPath];</p>
<p>	// nothing found<br />
	if (resourceDictionary == nil) {<br />
		return nil;<br />
	}</p>
<p>	UIImage *image = [UIImage imageNamed:[resourceDictionary objectForKey:@"image"]];<br />
	image = [image scaleToSize:CGSizeMake(80.0f, 100.0f)];</p>
<p>	return image;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Muchow</title>
		<link>http://MobileDeveloperTips.com/graphics/how-to-scale-an-image-using-an-objective-c-category.html#comment-8860</link>
		<dc:creator>John Muchow</dc:creator>
		<pubDate>Thu, 21 Jan 2010 22:16:00 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=4576#comment-8860</guid>
		<description>Hey Coop,

Thanks for the heads up and code example...

Readers: if you would like to read/download the thread safe example, check out part 2 of this post here: &lt;a href=&quot;http://iphonedevelopertips.com/graphics/how-to-resize-scale-an-image-thread-safe-take-2.html&quot; rel=&quot;nofollow&quot;&gt;How to Resize/Scale and Image using Thread Safe Code&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>Hey Coop,</p>
<p>Thanks for the heads up and code example&#8230;</p>
<p>Readers: if you would like to read/download the thread safe example, check out part 2 of this post here: <a href="http://iphonedevelopertips.com/graphics/how-to-resize-scale-an-image-thread-safe-take-2.html" rel="nofollow">How to Resize/Scale and Image using Thread Safe Code</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Coop</title>
		<link>http://MobileDeveloperTips.com/graphics/how-to-scale-an-image-using-an-objective-c-category.html#comment-8859</link>
		<dc:creator>Coop</dc:creator>
		<pubDate>Thu, 21 Jan 2010 22:11:14 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=4576#comment-8859</guid>
		<description>Just be aware that this code is not thread safe, since it depends on the global current context... If you would like code that is thread safe (and unfortunately a bit more complex ;)  I could post that

Coop</description>
		<content:encoded><![CDATA[<p>Just be aware that this code is not thread safe, since it depends on the global current context&#8230; If you would like code that is thread safe (and unfortunately a bit more complex ;)  I could post that</p>
<p>Coop</p>
]]></content:encoded>
	</item>
</channel>
</rss>

