<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Codec &#187; UIView</title>
	<atom:link href="http://www.trembl.org/codec/tag/uiview/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.trembl.org/codec</link>
	<description>A Personal Polylogic Code/Decode &#039;Zettelkasten&#039;</description>
	<lastBuildDate>Thu, 02 Feb 2012 03:38:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Adding an UIAlertView</title>
		<link>http://www.trembl.org/codec/590/</link>
		<comments>http://www.trembl.org/codec/590/#comments</comments>
		<pubDate>Wed, 12 May 2010 09:02:06 +0000</pubDate>
		<dc:creator>Georg Tremmel</dc:creator>
				<category><![CDATA[Raw]]></category>
		<category><![CDATA[display]]></category>
		<category><![CDATA[show]]></category>
		<category><![CDATA[UIAlertView]]></category>
		<category><![CDATA[UIView]]></category>

		<guid isPermaLink="false">http://www.trembl.org/codec/590/</guid>
		<description><![CDATA[Unlike other UIViews, UIAlertView does not need to be added to another view via addSubView. [myAlertView show] takes care of that. Trivial, maybe. But I wasn&#8217;t aware of it.]]></description>
			<content:encoded><![CDATA[<p>Unlike other UIViews, UIAlertView does not need to be added to another view via addSubView.<br />
[myAlertView show] takes care of that.</p>
<p>Trivial, maybe. But I wasn&#8217;t aware of it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.trembl.org/codec/590/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rotating an UIView</title>
		<link>http://www.trembl.org/codec/385/</link>
		<comments>http://www.trembl.org/codec/385/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 08:55:13 +0000</pubDate>
		<dc:creator>Georg Tremmel</dc:creator>
				<category><![CDATA[Raw]]></category>
		<category><![CDATA[radian]]></category>
		<category><![CDATA[rotate]]></category>
		<category><![CDATA[UIView]]></category>

		<guid isPermaLink="false">http://www.trembl.org/codec/?p=385</guid>
		<description><![CDATA[Rotating an UIView, here for 90 degree. UIImageView *v = &#91;&#91;UIImageView alloc&#93; initWithFrame:CGRectMake&#40;0.0, 0.0, 480, 320&#41;&#93;; v.center = CGPointMake&#40;160.0, 240.0&#41;; v.transform = CGAffineTransformMakeRotation&#40;M_PI/2&#41;; // radian!]]></description>
			<content:encoded><![CDATA[<p>Rotating an UIView, here for 90 degree.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">UIImageView <span style="color: #002200;">*</span>v <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIImageView alloc<span style="color: #002200;">&#93;</span> initWithFrame<span style="color: #002200;">:</span>CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0.0</span>, <span style="color: #2400d9;">0.0</span>, <span style="color: #2400d9;">480</span>, <span style="color: #2400d9;">320</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
v.center <span style="color: #002200;">=</span> CGPointMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">160.0</span>, <span style="color: #2400d9;">240.0</span><span style="color: #002200;">&#41;</span>;
v.transform <span style="color: #002200;">=</span> CGAffineTransformMakeRotation<span style="color: #002200;">&#40;</span>M_PI<span style="color: #002200;">/</span><span style="color: #2400d9;">2</span><span style="color: #002200;">&#41;</span>; <span style="color: #11740a; font-style: italic;">// radian!</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.trembl.org/codec/385/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transparent Background of Custom Drawing Class</title>
		<link>http://www.trembl.org/codec/361/</link>
		<comments>http://www.trembl.org/codec/361/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 07:38:19 +0000</pubDate>
		<dc:creator>Georg Tremmel</dc:creator>
				<category><![CDATA[Raw]]></category>
		<category><![CDATA[alpha]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[opaque]]></category>
		<category><![CDATA[transparent]]></category>
		<category><![CDATA[UIView]]></category>

		<guid isPermaLink="false">http://www.trembl.org/codec/?p=361</guid>
		<description><![CDATA[Usually common problems already have simple solution. Like that one: Problem You subclassed UIView, you want to do some custom drawing in drawRect, but no matter what you do or where you draw, the background of the view remains black. - &#40;void&#41;drawRect:&#40;CGRect&#41;rect &#123; // Drawing code CGContextRef context = UIGraphicsGetCurrentContext&#40;&#41;; CGContextSetRGBFillColor&#40;context, 0.0, 0.0, 1.0, 1.0&#41;; [...]]]></description>
			<content:encoded><![CDATA[<p>Usually common problems already have simple solution. Like that one:</p>
<p><strong>Problem</strong><br />
You subclassed UIView, you want to do some custom drawing in drawRect, but no matter what you do or where you draw, the background of the view remains black.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>drawRect<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>CGRect<span style="color: #002200;">&#41;</span>rect <span style="color: #002200;">&#123;</span>
 <span style="color: #11740a; font-style: italic;">// Drawing code</span>
 CGContextRef context <span style="color: #002200;">=</span> UIGraphicsGetCurrentContext<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>;
 CGContextSetRGBFillColor<span style="color: #002200;">&#40;</span>context, <span style="color: #2400d9;">0.0</span>, <span style="color: #2400d9;">0.0</span>, <span style="color: #2400d9;">1.0</span>, <span style="color: #2400d9;">1.0</span><span style="color: #002200;">&#41;</span>;
 CGContextFillEllipseInRect<span style="color: #002200;">&#40;</span>context, rect<span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p><strong>Solution</strong><br />
In the ViewController, which call the drawing class, add</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">myDrawingClass.opaque <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;</pre></div></div>

<p>- or even nicer. In the drawing class&#8217; init function:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">self.opaque <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;</pre></div></div>

<p><del datetime="2010-01-25T07:38:22+00:00"><strong>And not like that</strong><br />
- adding &#8220;self.opaque = NO;&#8221; in the drawRect: function<br />
- CGContextClearRect(context, rect);<br />
- CGContextSetAlpha(context, 0.5f);</del></p>
]]></content:encoded>
			<wfw:commentRss>http://www.trembl.org/codec/361/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programmatically capture UIView</title>
		<link>http://www.trembl.org/codec/355/</link>
		<comments>http://www.trembl.org/codec/355/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 07:59:08 +0000</pubDate>
		<dc:creator>Georg Tremmel</dc:creator>
				<category><![CDATA[Raw]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[capture]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[pixel]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[UIView]]></category>

		<guid isPermaLink="false">http://www.trembl.org/codec/?p=355</guid>
		<description><![CDATA[Ok, a bit late to the party. Apple officially approved the use of UIGetScreenImage(). After carefully considering the issue, Apple is now allowing applications to use the function UIGetScreenImage() to programmatically capture the current screen contents. The function prototype is as follows: CGImageRef UIGetScreenImage&#40;void&#41;; https://devforums.apple.com/message/149553 How to caputure a view, ideally the live input of [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, a bit late to the party. Apple officially approved the use of UIGetScreenImage().</p>
<blockquote><p>After carefully considering the issue, Apple is now allowing applications to use the function UIGetScreenImage() to programmatically capture the current screen contents.  The function prototype is as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">CGImageRef UIGetScreenImage<span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>;</pre></div></div>

</blockquote>
<p><a href="https://devforums.apple.com/message/149553">https://devforums.apple.com/message/149553</a></p>
<p><del datetime="2010-01-22T08:19:38+00:00">How to caputure a view, ideally the live input of the camera? Unfortunaly there&#8217;s no clean and clear interface for that. Only the undocumented UIGetScreenCapture() call:</del></p>
<p><a href="http://www.iphonedevsdk.com/forum/iphone-sdk-development/11219-screenshots-we-allowed-use-uigetscreenimage.html">http://www.iphonedevsdk.com/forum/iphone-sdk-development/11219-screenshots-we-allowed-use-uigetscreenimage.html</a></p>
<p><a href="http://stackoverflow.com/questions/1531815/takepicture-vs-uigetscreenimage">http://stackoverflow.com/questions/1531815/takepicture-vs-uigetscreenimage</a></p>
<p><a href="http://svn.saurik.com/repos/menes/trunk/iphonevnc/iPhoneVNC.mm">http://svn.saurik.com/repos/menes/trunk/iphonevnc/iPhoneVNC.mm<br />
</a></p>
<p><a href="http://blogs.oreilly.com/iphone/2008/10/creating-a-full-screen-camera.html<br />
">http://blogs.oreilly.com/iphone/2008/10/creating-a-full-screen-camera.html<br />
</a></p>
<p>But since UIGetScreenCapture() is an undocumented call (in 3.1), here are official ways to get the content of a view.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">UIGraphicsGetImageFromCurrentImageContext<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>;</pre></div></div>

<p><a href="http://icodeblog.com/2009/07/27/1188/">http://icodeblog.com/2009/07/27/1188/</a></p>
<p><a href="http://www.elrepositorio.com/?p=31">http://www.elrepositorio.com/?p=31</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.trembl.org/codec/355/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

