<?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: Saving a view as an image.</title>
	<atom:link href="http://www.skylarcantu.com/blog/2009/10/16/saving-a-view-as-an-image/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.skylarcantu.com/blog/2009/10/16/saving-a-view-as-an-image/</link>
	<description>...just some of my thoughts.</description>
	<lastBuildDate>Fri, 20 Aug 2010 13:33:09 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: DaveF</title>
		<link>http://www.skylarcantu.com/blog/2009/10/16/saving-a-view-as-an-image/comment-page-1/#comment-187</link>
		<dc:creator>DaveF</dc:creator>
		<pubDate>Thu, 05 Aug 2010 00:14:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.skylarcantu.com/blog/?p=299#comment-187</guid>
		<description>Awesome snippet Skylar.  One thing is that I&#039;m using this code on an iPad application in landscape orientation and the resulting screengrab is in portrait mode.  I know I could just alter the image itself but is there a cleaner way to get the image at the correct orientation?</description>
		<content:encoded><![CDATA[<p>Awesome snippet Skylar.  One thing is that I&#8217;m using this code on an iPad application in landscape orientation and the resulting screengrab is in portrait mode.  I know I could just alter the image itself but is there a cleaner way to get the image at the correct orientation?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DanCreek</title>
		<link>http://www.skylarcantu.com/blog/2009/10/16/saving-a-view-as-an-image/comment-page-1/#comment-164</link>
		<dc:creator>DanCreek</dc:creator>
		<pubDate>Mon, 29 Mar 2010 01:31:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.skylarcantu.com/blog/?p=299#comment-164</guid>
		<description>Thanks for the memory leak tip Andrew.  You just saved me hours of troubleshooting.</description>
		<content:encoded><![CDATA[<p>Thanks for the memory leak tip Andrew.  You just saved me hours of troubleshooting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Skylar</title>
		<link>http://www.skylarcantu.com/blog/2009/10/16/saving-a-view-as-an-image/comment-page-1/#comment-150</link>
		<dc:creator>Skylar</dc:creator>
		<pubDate>Thu, 14 Jan 2010 09:36:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.skylarcantu.com/blog/?p=299#comment-150</guid>
		<description>Good catch, I have not updated the sample code attached to post.  Honestly, this is such a simple post that I simply forgot that I had attached any downloadable source code.  I will update the download link at some indeterminate date in the future.

Thanks!

[WORDPRESS HASHCASH] The poster sent us &#039;0 which is not a hashcash value.</description>
		<content:encoded><![CDATA[<p>Good catch, I have not updated the sample code attached to post.  Honestly, this is such a simple post that I simply forgot that I had attached any downloadable source code.  I will update the download link at some indeterminate date in the future.</p>
<p>Thanks!</p>
<p>[WORDPRESS HASHCASH] The poster sent us &#8216;0 which is not a hashcash value.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nglayton</title>
		<link>http://www.skylarcantu.com/blog/2009/10/16/saving-a-view-as-an-image/comment-page-1/#comment-149</link>
		<dc:creator>nglayton</dc:creator>
		<pubDate>Sat, 09 Jan 2010 17:15:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.skylarcantu.com/blog/?p=299#comment-149</guid>
		<description>did the source attached to the post get updated. I can&#039;t tell, I don&#039;t see any of the lines talked about in the source code. Was there a 3rd change not posted ?</description>
		<content:encoded><![CDATA[<p>did the source attached to the post get updated. I can&#8217;t tell, I don&#8217;t see any of the lines talked about in the source code. Was there a 3rd change not posted ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Ash</title>
		<link>http://www.skylarcantu.com/blog/2009/10/16/saving-a-view-as-an-image/comment-page-1/#comment-147</link>
		<dc:creator>Andrew Ash</dc:creator>
		<pubDate>Sun, 20 Dec 2009 20:56:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.skylarcantu.com/blog/?p=299#comment-147</guid>
		<description>Thanks Skylar, CGImageRelease seems to be the way to go there.</description>
		<content:encoded><![CDATA[<p>Thanks Skylar, CGImageRelease seems to be the way to go there.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Skylar</title>
		<link>http://www.skylarcantu.com/blog/2009/10/16/saving-a-view-as-an-image/comment-page-1/#comment-146</link>
		<dc:creator>Skylar</dc:creator>
		<pubDate>Sun, 20 Dec 2009 08:22:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.skylarcantu.com/blog/?p=299#comment-146</guid>
		<description>Thanks for the catch.  That&#039;s the problem with writing up a quick tutorial without testing it, you sometimes forget releases : )

In the future though, you might want to use &lt;a href=&quot;http://developer.apple.com/mac/library/DOCUMENTATION/GraphicsImaging/Reference/CGImage/Reference/reference.html#//apple_ref/c/func/CGImageRelease&quot; rel=&quot;nofollow&quot;&gt;CGImageRelease &lt;/a&gt; instead of CFRelease.  According to Apple, the two are equivalent, except CGImageRelease won&#039;t throw an error if the image is NULL.

[WORDPRESS HASHCASH] The poster sent us &#039;0 which is not a hashcash value.</description>
		<content:encoded><![CDATA[<p>Thanks for the catch.  That&#8217;s the problem with writing up a quick tutorial without testing it, you sometimes forget releases : )</p>
<p>In the future though, you might want to use <a href="http://developer.apple.com/mac/library/DOCUMENTATION/GraphicsImaging/Reference/CGImage/Reference/reference.html#//apple_ref/c/func/CGImageRelease" rel="nofollow">CGImageRelease </a> instead of CFRelease.  According to Apple, the two are equivalent, except CGImageRelease won&#8217;t throw an error if the image is NULL.</p>
<p>[WORDPRESS HASHCASH] The poster sent us &#8216;0 which is not a hashcash value.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Ash</title>
		<link>http://www.skylarcantu.com/blog/2009/10/16/saving-a-view-as-an-image/comment-page-1/#comment-145</link>
		<dc:creator>Andrew Ash</dc:creator>
		<pubDate>Sun, 20 Dec 2009 07:58:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.skylarcantu.com/blog/?p=299#comment-145</guid>
		<description>I&#039;ve been struggling with a memory leak in an iPhone app, and I think I&#039;ve traced it down to using the takeScreenshot method you have above.  The relevant line is this:

UIImage *screenshot = [UIImage imageWithCGImage:UIGetScreenImage()];

This line calls UIGetScreenImage(), which returns a CGImageRef, and uses that reference to create a UIImage.  The problem I think is in what is done with the CGImageRef.  It seems that UIGetScreenImage expects you to release the CGImageRef yourself, using CGRelease.  Replacing the above line of code with the following lines fixed a massive memory leak I had:

CGImageRef screenshotCG = UIGetScreenImage();
UIImage *screenshot = [UIImage imageWithCGImage:screenshotCG];
CFRelease(screenshotCG);

Credit where credit is due -- I had the idea to check this from a code snippet at:
http://netsharc.wordpress.com/2008/12/25/iphone-dev-creating-a-full-screen-camera-preview/</description>
		<content:encoded><![CDATA[<p>I&#8217;ve been struggling with a memory leak in an iPhone app, and I think I&#8217;ve traced it down to using the takeScreenshot method you have above.  The relevant line is this:</p>
<p>UIImage *screenshot = [UIImage imageWithCGImage:UIGetScreenImage()];</p>
<p>This line calls UIGetScreenImage(), which returns a CGImageRef, and uses that reference to create a UIImage.  The problem I think is in what is done with the CGImageRef.  It seems that UIGetScreenImage expects you to release the CGImageRef yourself, using CGRelease.  Replacing the above line of code with the following lines fixed a massive memory leak I had:</p>
<p>CGImageRef screenshotCG = UIGetScreenImage();<br />
UIImage *screenshot = [UIImage imageWithCGImage:screenshotCG];<br />
CFRelease(screenshotCG);</p>
<p>Credit where credit is due &#8212; I had the idea to check this from a code snippet at:<br />
<a href="http://netsharc.wordpress.com/2008/12/25/iphone-dev-creating-a-full-screen-camera-preview/" rel="nofollow">http://netsharc.wordpress.com/2008/12/25/iphone-dev-creating-a-full-screen-camera-preview/</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
