<?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; delay</title>
	<atom:link href="http://www.trembl.org/codec/tag/delay/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>Delaying Methods. And cancelling the delaying of methods</title>
		<link>http://www.trembl.org/codec/594/</link>
		<comments>http://www.trembl.org/codec/594/#comments</comments>
		<pubDate>Tue, 18 May 2010 09:11:36 +0000</pubDate>
		<dc:creator>Georg Tremmel</dc:creator>
				<category><![CDATA[Raw]]></category>
		<category><![CDATA[cancel]]></category>
		<category><![CDATA[delay]]></category>
		<category><![CDATA[longest method name]]></category>
		<category><![CDATA[method]]></category>

		<guid isPermaLink="false">http://www.trembl.org/codec/594/</guid>
		<description><![CDATA[Delaying a method should be by now fairly clear: &#91;self performSelector:@selector&#40;myMethod&#41; withObject:nil afterDelay:3&#93;; But what, if you need to cancel the delayed perform request? That&#8217;s the way to do it: &#91;NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector&#40;myMethod&#41; object:nil&#93;; &#8216;cancelPreviousPerformRequestsWithTarget&#8216; seems to be the current leader in the &#8216;Longest Objective C Method Name Competition&#8221; with 39 characters, not bad. Let [...]]]></description>
			<content:encoded><![CDATA[<p>Delaying a method should be by now fairly clear:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#91;</span>self performSelector<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>myMethod<span style="color: #002200;">&#41;</span> withObject<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> afterDelay<span style="color: #002200;">:</span><span style="color: #2400d9;">3</span><span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>But what, if you need to cancel the delayed perform request? That&#8217;s the way to do it:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSObject</span> cancelPreviousPerformRequestsWithTarget<span style="color: #002200;">:</span>self selector<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>myMethod<span style="color: #002200;">&#41;</span> object<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;</pre></div></div>

<p><em>&#8216;<strong>cancelPreviousPerformRequestsWithTarget</strong>&#8216; seems to be the current leader in the &#8216;Longest Objective C Method Name Competition&#8221; with 39 characters, not bad.</p>
<p>Let me <a href="http://www.twitter.com/trembl">know</a>, if you find any more contenders&#8230;<br />
</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.trembl.org/codec/594/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Delay method execution, part II</title>
		<link>http://www.trembl.org/codec/374/</link>
		<comments>http://www.trembl.org/codec/374/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 09:13:09 +0000</pubDate>
		<dc:creator>Georg Tremmel</dc:creator>
				<category><![CDATA[Raw]]></category>
		<category><![CDATA[delay]]></category>
		<category><![CDATA[execution]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[NSTimer]]></category>

		<guid isPermaLink="false">http://www.trembl.org/codec/?p=374</guid>
		<description><![CDATA[&#91;NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector: @selector&#40;methodName:&#41; userInfo:nil repeats:NO&#93;; Alternative to Part I [35], has the possibility of repetetive calls.]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSTimer</span> scheduledTimerWithTimeInterval<span style="color: #002200;">:</span><span style="color: #2400d9;">1.0</span> 
target<span style="color: #002200;">:</span>self selector<span style="color: #002200;">:</span> <span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>methodName<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span>  
userInfo<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> repeats<span style="color: #002200;">:</span><span style="color: #a61390;">NO</span><span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>Alternative to <a href="http://www.trembl.org/codec/35/">Part I [35]</a>, has the possibility of repetetive calls.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.trembl.org/codec/374/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Delay method execution &amp; passing objects along the way</title>
		<link>http://www.trembl.org/codec/58/</link>
		<comments>http://www.trembl.org/codec/58/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 10:31:46 +0000</pubDate>
		<dc:creator>Georg Tremmel</dc:creator>
				<category><![CDATA[Raw]]></category>
		<category><![CDATA[delay]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[performSelector]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://www.trembl.org/codec/?p=58</guid>
		<description><![CDATA[Specific example. Deselect table cell after a certain time. TableView and indexPath are wrapped into an array and send along to the method for delayed execution. - (void)tableView:(UITableView *)tView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"User selected row %d\n", [indexPath row] + 1); // actions [self performSelector:@selector(deselectTableCell:) withObject:[NSArray arrayWithObjects:tView, indexPath, nil] afterDelay:0.2f]; } -(void) deselectTableCell:(NSArray *)array { [[ [...]]]></description>
			<content:encoded><![CDATA[<p>Specific example. Deselect table cell after a certain time. TableView and indexPath are wrapped into an array and send along to the method for delayed execution.</p>
<p><code><br />
- (void)tableView:(UITableView *)tView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {<br />
	NSLog(@"User selected row %d\n", [indexPath row] + 1);<br />
	// actions<br />
	[self performSelector:@selector(deselectTableCell:) withObject:[NSArray arrayWithObjects:tView, indexPath, nil] afterDelay:0.2f];<br />
}</p>
<p>-(void) deselectTableCell:(NSArray *)array {<br />
	[[ [array objectAtIndex:0] cellForRowAtIndexPath:[array objectAtIndex:1] ] setSelected:NO];<br />
	NSLog(@"deselectTableCell" );<br />
}<br />
</code></p>
<p>In additon to <a href="http://www.trembl.org/codec/35/">http://www.trembl.org/codec/35/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.trembl.org/codec/58/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Delay method execution</title>
		<link>http://www.trembl.org/codec/35/</link>
		<comments>http://www.trembl.org/codec/35/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 10:08:03 +0000</pubDate>
		<dc:creator>Georg Tremmel</dc:creator>
				<category><![CDATA[Raw]]></category>
		<category><![CDATA[delay]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://www.trembl.org/codec/?p=35</guid>
		<description><![CDATA[[self performSelector:@selector(methodName) withObject:nil afterDelay:0.10f]; update: http://www.trembl.org/codec/58/]]></description>
			<content:encoded><![CDATA[<p>[self performSelector:@selector(methodName) withObject:nil afterDelay:0.10f];</p>
<p>update: <a href="http://www.trembl.org/codec/58/">http://www.trembl.org/codec/58/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.trembl.org/codec/35/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

