<?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>Apfelsaft &#187; animator</title>
	<atom:link href="http://www.deelen.de/tag/animator/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.deelen.de</link>
	<description>Yet another Mac developer blog</description>
	<lastBuildDate>Sun, 03 Mar 2024 08:13:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Cocoa Animation Proxy &#8220;woes&#8221;</title>
		<link>http://www.deelen.de/2010/02/cocoa-animation-proxies-woes/</link>
		<comments>http://www.deelen.de/2010/02/cocoa-animation-proxies-woes/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 14:24:45 +0000</pubDate>
		<dc:creator>Joachim</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[animator]]></category>
		<category><![CDATA[cocoa]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[setHidden]]></category>

		<guid isPermaLink="false">http://www.deelen.de/?p=114</guid>
		<description><![CDATA[Both, NSWindow and NSView offer a convenient way to add animation to your UI by the use of animation proxies. But there are some &#8220;woes&#8221; you have to keep in mind.

E.g. if you want to switch the visibility state you normally use:

[aView setHidden:YES]; // Hide the view
// very important code....
[aView setHidden:NO]; // Un-Hide the view

To [...]]]></description>
			<content:encoded><![CDATA[<p>Both, NSWindow and NSView offer a convenient way to add animation to your UI by the use of animation proxies. But there are some &#8220;woes&#8221; you have to keep in mind.<br />
<span id="more-114"></span><br />
E.g. if you want to switch the visibility state you normally use:</p>
<pre class="brush: objc;">
[aView setHidden:YES]; // Hide the view
// very important code....
[aView setHidden:NO]; // Un-Hide the view
</pre>
<p>To do the same thing with a short and smooth animation, you just have to change the above code to the following:</p>
<pre class="brush: objc;">
[[aView animator] setHidden:YES]; // Hide the view with animation
// very important code....
[[aView animator] setHidden:NO]; // Un-Hide the view with animation
</pre>
<p>(For some animations, like subview transitions, <kbd>aView</kbd> has to be layer-backed which can be accomplished with a call to <kbd>[aView setWantsLayer:YES];</kbd>)</p>
<p>So far so good. But what, if <kbd>aView</kbd> is a custom subclass of NSView, NSBox or whatsoever?</p>
<p>Normally, this is not a problem, since the object returned by <kbd>[aView animator]</kbd> is a proxy object for the original object and can be treated as if it was the original object itself.</p>
<p>But, there is a difference! If you call <kbd>setHidden:YES</kbd> on the original object, it gets called, regardless of the actual &#8220;hidden-state&#8221; of the view. If you call it on the proxy-object, it gets called only, if the value really changes. So calling <kbd>setHidden:YES</kbd> on an animator-proxy, which original-object is already hidden, has no effect at all.</p>
<p>This behavior can be ignored, as long as you do not overwrite any of the methods that change animateable properties, like <kbd>setHidden:</kbd>. But if you do, keep in mind, that your overwritten method may not be called while using the animator-proxy. In some cases, were you depend upon the fact, that your method gets always called, this can be a problem e.g. if you always want to do something in your setter, regardless of what the actual state or value is.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.deelen.de/2010/02/cocoa-animation-proxies-woes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
