<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2italianfull.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Undolog.com</title><link>http://www.undolog.com</link><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/undolog" /><description>Research &amp; Development  Blog</description><language>en</language><lastBuildDate>Fri, 05 Feb 2010 15:30:16 PST</lastBuildDate><generator>http://wordpress.org/?v=2.9.1</generator><sy:updatePeriod xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">hourly</sy:updatePeriod><sy:updateFrequency xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">1</sy:updateFrequency><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/undolog" /><feedburner:info uri="undolog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/2.0/</creativeCommons:license><image><link>http://creativecommons.org/licenses/by-nc-nd/2.0/</link><url>http://creativecommons.org/images/public/somerights20.gif</url><title>Some Rights Reserved</title></image><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fundolog" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/undolog" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fundolog" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fundolog" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fundolog" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><feedburner:feedFlare href="http://add.my.yahoo.com/content?lg=it&amp;url=http%3A%2F%2Ffeeds.feedburner.com%2Fundolog" src="http://eur.i1.yimg.com/eur.yimg.com/i/it/my/mioya1.gif">Subscribe with Mio Yahoo!</feedburner:feedFlare><item><title>Wordpress: filtrate il contenuto dei commenti</title><link>http://feedproxy.google.com/~r/undolog/~3/uh9xP1b5R5U/</link><category>Internet</category><category>PHP</category><category>Sviluppo</category><category>WordPress</category><category>add_filter()</category><category>Commento</category><category>comment_text</category><category>content</category><category>functions.php</category><category>get_comment_text</category><category>strlen()</category><category>substr()</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Giovambattista Fazioli</dc:creator><pubDate>Fri, 05 Feb 2010 15:30:16 PST</pubDate><guid isPermaLink="false">http://www.undolog.com/?p=2888</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/rQEi4yrkZjOhL2J6JtqR-TX3HiE/0/da"><img src="http://feedads.g.doubleclick.net/~a/rQEi4yrkZjOhL2J6JtqR-TX3HiE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/rQEi4yrkZjOhL2J6JtqR-TX3HiE/1/da"><img src="http://feedads.g.doubleclick.net/~a/rQEi4yrkZjOhL2J6JtqR-TX3HiE/1/di" border="0" ismap="true"></img></a></p><p>Mi è capitato di dover sistemare un fastidioso problema su un blog Wordpress: gli utenti lasciavano commenti con frasi lunghissime. Questo produceva la fuoriuscita del testo, sia nel backend che, ancor peggio, nel frontend. L'effetto era davvero orribile e, onde evitare di moderare a mano ogni singolo commento, l'unica soluzione era quella di filtrare - in qualche modo - l'output dei commenti.<br />
Fortunatamente (ed è una delle ragione per cui tutto sommato adoro WP) Wordpress permette di aggiungere un filtro all'output dei commenti. Nel mio caso è bastato aggiungere nel file <code>functions.php</code> le seguenti righe di codice:</p>
<div class="igBar"><span id="lphp-2"><a href="#" onclick="javascript:showCodeTxt('php-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-2">
<div class="php" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">function</span> filter_comment<span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/explode"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$word</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/strlen"><span style="color: #990000;">strlen</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$word</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&gt;</span> 20<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$word</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$word</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;color:#800000;">20</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;[t...]&quot;</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$content</span> <span style="color: #339933;">.=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$word</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$word</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$content</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'comment_text'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'filter_comment'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'get_comment_text '</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'filter_comment'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Le parole troppo lunghe (maggiori di 20) vengono tagliate e, alla fine, gli aggiungo <code>[t...]</code> - per indicare che è una parola tagliata.</p>




	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F06%2Fwordpress-filtrate-il-contenuto-dei-commenti%2F&amp;title=Wordpress%3A%20filtrate%20il%20contenuto%20dei%20commenti&amp;bodytext=Mi%20%C3%A8%20capitato%20di%20dover%20sistemare%20un%20fastidioso%20problema%20su%20un%20blog%20Wordpress%3A%20gli%20utenti%20lasciavano%20commenti%20con%20frasi%20lunghissime.%20Questo%20produceva%20la%20fuoriuscita%20del%20testo%2C%20sia%20nel%20backend%20che%2C%20ancor%20peggio%2C%20nel%20frontend.%20L%27effetto%20era%20davvero%20orr" title="Digg"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F06%2Fwordpress-filtrate-il-contenuto-dei-commenti%2F&amp;title=Wordpress%3A%20filtrate%20il%20contenuto%20dei%20commenti&amp;notes=Mi%20%C3%A8%20capitato%20di%20dover%20sistemare%20un%20fastidioso%20problema%20su%20un%20blog%20Wordpress%3A%20gli%20utenti%20lasciavano%20commenti%20con%20frasi%20lunghissime.%20Questo%20produceva%20la%20fuoriuscita%20del%20testo%2C%20sia%20nel%20backend%20che%2C%20ancor%20peggio%2C%20nel%20frontend.%20L%27effetto%20era%20davvero%20orr" title="del.icio.us"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F06%2Fwordpress-filtrate-il-contenuto-dei-commenti%2F" title="Technorati"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F06%2Fwordpress-filtrate-il-contenuto-dei-commenti%2F&amp;t=Wordpress%3A%20filtrate%20il%20contenuto%20dei%20commenti" title="Facebook"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F06%2Fwordpress-filtrate-il-contenuto-dei-commenti%2F&amp;title=Wordpress%3A%20filtrate%20il%20contenuto%20dei%20commenti&amp;annotation=Mi%20%C3%A8%20capitato%20di%20dover%20sistemare%20un%20fastidioso%20problema%20su%20un%20blog%20Wordpress%3A%20gli%20utenti%20lasciavano%20commenti%20con%20frasi%20lunghissime.%20Questo%20produceva%20la%20fuoriuscita%20del%20testo%2C%20sia%20nel%20backend%20che%2C%20ancor%20peggio%2C%20nel%20frontend.%20L%27effetto%20era%20davvero%20orr" title="Google Bookmarks"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Wordpress%3A%20filtrate%20il%20contenuto%20dei%20commenti%20-%20http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F06%2Fwordpress-filtrate-il-contenuto-dei-commenti%2F" title="Twitter"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://barrapunto.com/submit.pl?subj=Wordpress%3A%20filtrate%20il%20contenuto%20dei%20commenti&amp;story=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F06%2Fwordpress-filtrate-il-contenuto-dei-commenti%2F" title="BarraPunto"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://current.com/clipper.htm?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F06%2Fwordpress-filtrate-il-contenuto-dei-commenti%2F&amp;title=Wordpress%3A%20filtrate%20il%20contenuto%20dei%20commenti" title="Current"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/current.png" title="Current" alt="Current" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=Wordpress%3A%20filtrate%20il%20contenuto%20dei%20commenti&amp;body=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F06%2Fwordpress-filtrate-il-contenuto-dei-commenti%2F" title="email"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Wordpress%3A%20filtrate%20il%20contenuto%20dei%20commenti&amp;link=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F06%2Fwordpress-filtrate-il-contenuto-dei-commenti%2F" title="FriendFeed"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://laaik.it/NewStoryCompact.aspx?uri=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F06%2Fwordpress-filtrate-il-contenuto-dei-commenti%2F&amp;headline=Wordpress%3A%20filtrate%20il%20contenuto%20dei%20commenti&amp;cat=5e082fcc-8a3b-47e2-acec-fdf64ff19d12" title="laaik.it"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/laaikit.png" title="laaik.it" alt="laaik.it" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F06%2Fwordpress-filtrate-il-contenuto-dei-commenti%2F&amp;title=Wordpress%3A%20filtrate%20il%20contenuto%20dei%20commenti&amp;source=Undolog.com+Research+%26amp%3B+Development++Blog&amp;summary=Mi%20%C3%A8%20capitato%20di%20dover%20sistemare%20un%20fastidioso%20problema%20su%20un%20blog%20Wordpress%3A%20gli%20utenti%20lasciavano%20commenti%20con%20frasi%20lunghissime.%20Questo%20produceva%20la%20fuoriuscita%20del%20testo%2C%20sia%20nel%20backend%20che%2C%20ancor%20peggio%2C%20nel%20frontend.%20L%27effetto%20era%20davvero%20orr" title="LinkedIn"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F06%2Fwordpress-filtrate-il-contenuto-dei-commenti%2F&amp;title=Wordpress%3A%20filtrate%20il%20contenuto%20dei%20commenti" title="Live"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F06%2Fwordpress-filtrate-il-contenuto-dei-commenti%2F&amp;t=Wordpress%3A%20filtrate%20il%20contenuto%20dei%20commenti" title="MySpace"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Wordpress%3A%20filtrate%20il%20contenuto%20dei%20commenti&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F06%2Fwordpress-filtrate-il-contenuto-dei-commenti%2F" title="Netvibes"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F06%2Fwordpress-filtrate-il-contenuto-dei-commenti%2F&amp;partner=sociable" title="Print"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.undolog.com/feed/" title="RSS"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://segnalo.alice.it/post.html.php?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F06%2Fwordpress-filtrate-il-contenuto-dei-commenti%2F&amp;title=Wordpress%3A%20filtrate%20il%20contenuto%20dei%20commenti" title="Segnalo"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/segnalo.png" title="Segnalo" alt="Segnalo" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F06%2Fwordpress-filtrate-il-contenuto-dei-commenti%2F&amp;title=Wordpress%3A%20filtrate%20il%20contenuto%20dei%20commenti" title="StumbleUpon"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.wikio.it/vote?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F06%2Fwordpress-filtrate-il-contenuto-dei-commenti%2F" title="Wikio IT"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/wikio.png" title="Wikio IT" alt="Wikio IT" class="sociable-hovers" /></a>


<br/><br/>
	Tags: <a href="http://www.undolog.com/tag/add_filter/" title="add_filter()" rel="tag">add_filter()</a>, <a href="http://www.undolog.com/tag/commento/" title="Commento" rel="tag">Commento</a>, <a href="http://www.undolog.com/tag/comment_text/" title="comment_text" rel="tag">comment_text</a>, <a href="http://www.undolog.com/tag/content/" title="content" rel="tag">content</a>, <a href="http://www.undolog.com/tag/functionsphp/" title="functions.php" rel="tag">functions.php</a>, <a href="http://www.undolog.com/tag/get_comment_text/" title="get_comment_text" rel="tag">get_comment_text</a>, <a href="http://www.undolog.com/category/sviluppo/internet/" title="Internet" rel="tag">Internet</a>, <a href="http://www.undolog.com/category/sviluppo/internet/php/" title="PHP" rel="tag">PHP</a>, <a href="http://www.undolog.com/tag/php/" title="PHP" rel="tag">PHP</a>, <a href="http://www.undolog.com/tag/strlen/" title="strlen()" rel="tag">strlen()</a>, <a href="http://www.undolog.com/tag/substr/" title="substr()" rel="tag">substr()</a>, <a href="http://www.undolog.com/category/sviluppo/" title="Sviluppo" rel="tag">Sviluppo</a>, <a href="http://www.undolog.com/category/sviluppo/internet/wordpress/" title="WordPress" rel="tag">WordPress</a>, <a href="http://www.undolog.com/tag/wordpress/" title="WordPress" rel="tag">WordPress</a><br />

	<h4>Post correlati</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.undolog.com/2009/07/03/wordpress-usare-gli-shortcodes/" title="Wordpress: usare gli shortcodes (3 luglio, 2009)">Wordpress: usare gli shortcodes</a> (5)</li>
	<li><a href="http://www.undolog.com/2009/01/16/wordpress-functionsphp-qualche-funzione-utile/" title="Wordpress: functions.php, qualche funzione utile (16 gennaio, 2009)">Wordpress: functions.php, qualche funzione utile</a> (0)</li>
	<li><a href="http://www.undolog.com/2010/01/26/wordpress-estendere-le-informazioni-utente/" title="Wordpress: estendere le informazioni utente (26 gennaio, 2010)">Wordpress: estendere le informazioni utente</a> (0)</li>
	<li><a href="http://www.undolog.com/2009/11/30/very-short-snippet-wordpress-lista-categorie-con-checkbox/" title="Very short snippet: Wordpress, lista categorie con checkbox (30 novembre, 2009)">Very short snippet: Wordpress, lista categorie con checkbox</a> (1)</li>
	<li><a href="http://www.undolog.com/2009/01/05/wordpress-wp_parse_args/" title="Wordpress: wp_parse_args() (5 gennaio, 2009)">Wordpress: wp_parse_args()</a> (3)</li>
</ul>

<img src="http://feeds.feedburner.com/~r/undolog/~4/uh9xP1b5R5U" height="1" width="1"/>]]></content:encoded><description>Mi è capitato di dover sistemare un fastidioso problema su un blog Wordpress: gli utenti lasciavano commenti con frasi lunghissime. Questo produceva la fuoriuscita del testo, sia nel backend che, ancor peggio, nel frontend. L'effetto era davvero orribile e, onde evitare di moderare a mano ogni singolo commento, l'unica soluzione era quella di filtrare - [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.undolog.com/2010/02/06/wordpress-filtrate-il-contenuto-dei-commenti/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://www.undolog.com/2010/02/06/wordpress-filtrate-il-contenuto-dei-commenti/</feedburner:origLink></item><item><title>Very short snippet: ottenere l’output di un URL in Objective-C</title><link>http://feedproxy.google.com/~r/undolog/~3/BrI41qWDal0/</link><category>Mobile</category><category>Objective-C</category><category>Sviluppo</category><category>api</category><category>NSString</category><category>REST</category><category>Snipp</category><category>Snippets</category><category>stringWithContentsOfURL</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Giovambattista Fazioli</dc:creator><pubDate>Thu, 04 Feb 2010 16:23:41 PST</pubDate><guid isPermaLink="false">http://www.undolog.com/?p=2879</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/abZI6FYKGBOdqrPVHi0nTpxvZYI/0/da"><img src="http://feedads.g.doubleclick.net/~a/abZI6FYKGBOdqrPVHi0nTpxvZYI/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/abZI6FYKGBOdqrPVHi0nTpxvZYI/1/da"><img src="http://feedads.g.doubleclick.net/~a/abZI6FYKGBOdqrPVHi0nTpxvZYI/1/di" border="0" ismap="true"></img></a></p><p>Avrei forse dovuto scrivere "Very very very, short snippet", tuttavia è un ottimo e comodissimo "trucchetto" questo che sto per mostrare. Eseguendo le "due" righe di codice indicate qui sotto, è possibile ottenere l'output di qualsiasi URL e manipolarlo.</p>
<div class="igBar"><span id="lobjc-5"><a href="#" onclick="javascript:showCodeTxt('objc-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-5">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>url <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> stringWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;http://www.appleside.it/&quot;</span><span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>result <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> stringWithContentsOfURL<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span style="color: #400080;">NSURL</span></a> URLWithString<span style="color: #002200;">:</span>url<span style="color: #002200;">&#93;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; encoding<span style="color: #002200;">:</span>NSASCIIStringEncoding </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Read from : %@ = &quot;</span>,apiEndpoint, result<span style="color: #002200;">&#41;</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p>
Ad esempio potremmo sfruttare molti servizi <strong>API REST</strong> per risolvere svariate problematiche. Tanto per fare un esempio pratico, immaginiamo di volre "comprimere"(trim) l'url http://www.undolog.com, come fanno molti servizi come <strong>Twitter</strong>, <strong>FriendFeed</strong> o <strong>Facebook</strong>. Ebbene potremmo sfruttare questo semplice codice:</p>
<div class="igBar"><span id="lobjc-6"><a href="#" onclick="javascript:showCodeTxt('objc-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-6">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>url <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;http://www.undolog.com&quot;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>apiRest <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> stringWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;http://api.tr.im/v1/trim_simple?url=%@&quot;</span>,url<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>result <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> stringWithContentsOfURL<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span style="color: #400080;">NSURL</span></a> URLWithString<span style="color: #002200;">:</span>apiEndpoint<span style="color: #002200;">&#93;</span> </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; encoding<span style="color: #002200;">:</span>NSASCIIStringEncoding </div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;URL Originale: %@ - URL Compresso: %@&quot;</span>,url, result<span style="color: #002200;">&#41;</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p>
Tutto il merito, ovviamente, è del metodo <strong><code>stringWithContentsOfURL</code></strong>: in quanto permette di caricare in una stringa il contenuto (output) di un URL.</p>




	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F05%2Fvery-short-snippet-ottenere-loutput-di-un-url-in-objective-c%2F&amp;title=Very%20short%20snippet%3A%20ottenere%20l%27output%20di%20un%20URL%20in%20Objective-C&amp;bodytext=Avrei%20forse%20dovuto%20scrivere%20%22Very%20very%20very%2C%20short%20snippet%22%2C%20tuttavia%20%C3%A8%20un%20ottimo%20e%20comodissimo%20%22trucchetto%22%20questo%20che%20sto%20per%20mostrare.%20Eseguendo%20le%20%22due%22%20righe%20di%20codice%20indicate%20qui%20sotto%2C%20%C3%A8%20possibile%20ottenere%20l%27output%20di%20qualsiasi%20URL%20e%20manipo" title="Digg"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F05%2Fvery-short-snippet-ottenere-loutput-di-un-url-in-objective-c%2F&amp;title=Very%20short%20snippet%3A%20ottenere%20l%27output%20di%20un%20URL%20in%20Objective-C&amp;notes=Avrei%20forse%20dovuto%20scrivere%20%22Very%20very%20very%2C%20short%20snippet%22%2C%20tuttavia%20%C3%A8%20un%20ottimo%20e%20comodissimo%20%22trucchetto%22%20questo%20che%20sto%20per%20mostrare.%20Eseguendo%20le%20%22due%22%20righe%20di%20codice%20indicate%20qui%20sotto%2C%20%C3%A8%20possibile%20ottenere%20l%27output%20di%20qualsiasi%20URL%20e%20manipo" title="del.icio.us"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F05%2Fvery-short-snippet-ottenere-loutput-di-un-url-in-objective-c%2F" title="Technorati"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F05%2Fvery-short-snippet-ottenere-loutput-di-un-url-in-objective-c%2F&amp;t=Very%20short%20snippet%3A%20ottenere%20l%27output%20di%20un%20URL%20in%20Objective-C" title="Facebook"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F05%2Fvery-short-snippet-ottenere-loutput-di-un-url-in-objective-c%2F&amp;title=Very%20short%20snippet%3A%20ottenere%20l%27output%20di%20un%20URL%20in%20Objective-C&amp;annotation=Avrei%20forse%20dovuto%20scrivere%20%22Very%20very%20very%2C%20short%20snippet%22%2C%20tuttavia%20%C3%A8%20un%20ottimo%20e%20comodissimo%20%22trucchetto%22%20questo%20che%20sto%20per%20mostrare.%20Eseguendo%20le%20%22due%22%20righe%20di%20codice%20indicate%20qui%20sotto%2C%20%C3%A8%20possibile%20ottenere%20l%27output%20di%20qualsiasi%20URL%20e%20manipo" title="Google Bookmarks"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Very%20short%20snippet%3A%20ottenere%20l%27output%20di%20un%20URL%20in%20Objective-C%20-%20http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F05%2Fvery-short-snippet-ottenere-loutput-di-un-url-in-objective-c%2F" title="Twitter"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://barrapunto.com/submit.pl?subj=Very%20short%20snippet%3A%20ottenere%20l%27output%20di%20un%20URL%20in%20Objective-C&amp;story=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F05%2Fvery-short-snippet-ottenere-loutput-di-un-url-in-objective-c%2F" title="BarraPunto"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://current.com/clipper.htm?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F05%2Fvery-short-snippet-ottenere-loutput-di-un-url-in-objective-c%2F&amp;title=Very%20short%20snippet%3A%20ottenere%20l%27output%20di%20un%20URL%20in%20Objective-C" title="Current"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/current.png" title="Current" alt="Current" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=Very%20short%20snippet%3A%20ottenere%20l%27output%20di%20un%20URL%20in%20Objective-C&amp;body=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F05%2Fvery-short-snippet-ottenere-loutput-di-un-url-in-objective-c%2F" title="email"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Very%20short%20snippet%3A%20ottenere%20l%27output%20di%20un%20URL%20in%20Objective-C&amp;link=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F05%2Fvery-short-snippet-ottenere-loutput-di-un-url-in-objective-c%2F" title="FriendFeed"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://laaik.it/NewStoryCompact.aspx?uri=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F05%2Fvery-short-snippet-ottenere-loutput-di-un-url-in-objective-c%2F&amp;headline=Very%20short%20snippet%3A%20ottenere%20l%27output%20di%20un%20URL%20in%20Objective-C&amp;cat=5e082fcc-8a3b-47e2-acec-fdf64ff19d12" title="laaik.it"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/laaikit.png" title="laaik.it" alt="laaik.it" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F05%2Fvery-short-snippet-ottenere-loutput-di-un-url-in-objective-c%2F&amp;title=Very%20short%20snippet%3A%20ottenere%20l%27output%20di%20un%20URL%20in%20Objective-C&amp;source=Undolog.com+Research+%26amp%3B+Development++Blog&amp;summary=Avrei%20forse%20dovuto%20scrivere%20%22Very%20very%20very%2C%20short%20snippet%22%2C%20tuttavia%20%C3%A8%20un%20ottimo%20e%20comodissimo%20%22trucchetto%22%20questo%20che%20sto%20per%20mostrare.%20Eseguendo%20le%20%22due%22%20righe%20di%20codice%20indicate%20qui%20sotto%2C%20%C3%A8%20possibile%20ottenere%20l%27output%20di%20qualsiasi%20URL%20e%20manipo" title="LinkedIn"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F05%2Fvery-short-snippet-ottenere-loutput-di-un-url-in-objective-c%2F&amp;title=Very%20short%20snippet%3A%20ottenere%20l%27output%20di%20un%20URL%20in%20Objective-C" title="Live"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F05%2Fvery-short-snippet-ottenere-loutput-di-un-url-in-objective-c%2F&amp;t=Very%20short%20snippet%3A%20ottenere%20l%27output%20di%20un%20URL%20in%20Objective-C" title="MySpace"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Very%20short%20snippet%3A%20ottenere%20l%27output%20di%20un%20URL%20in%20Objective-C&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F05%2Fvery-short-snippet-ottenere-loutput-di-un-url-in-objective-c%2F" title="Netvibes"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F05%2Fvery-short-snippet-ottenere-loutput-di-un-url-in-objective-c%2F&amp;partner=sociable" title="Print"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.undolog.com/feed/" title="RSS"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://segnalo.alice.it/post.html.php?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F05%2Fvery-short-snippet-ottenere-loutput-di-un-url-in-objective-c%2F&amp;title=Very%20short%20snippet%3A%20ottenere%20l%27output%20di%20un%20URL%20in%20Objective-C" title="Segnalo"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/segnalo.png" title="Segnalo" alt="Segnalo" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F05%2Fvery-short-snippet-ottenere-loutput-di-un-url-in-objective-c%2F&amp;title=Very%20short%20snippet%3A%20ottenere%20l%27output%20di%20un%20URL%20in%20Objective-C" title="StumbleUpon"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.wikio.it/vote?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F02%2F05%2Fvery-short-snippet-ottenere-loutput-di-un-url-in-objective-c%2F" title="Wikio IT"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/wikio.png" title="Wikio IT" alt="Wikio IT" class="sociable-hovers" /></a>


<br/><br/>
	Tags: <a href="http://www.undolog.com/tag/api/" title="api" rel="tag">api</a>, <a href="http://www.undolog.com/category/mobile/" title="Mobile" rel="tag">Mobile</a>, <a href="http://www.undolog.com/tag/nsstring/" title="NSString" rel="tag">NSString</a>, <a href="http://www.undolog.com/tag/objective-c/" title="Objective-C" rel="tag">Objective-C</a>, <a href="http://www.undolog.com/category/sviluppo/iphone-sviluppo/objective-c-sviluppo/" title="Objective-C" rel="tag">Objective-C</a>, <a href="http://www.undolog.com/tag/rest/" title="REST" rel="tag">REST</a>, <a href="http://www.undolog.com/tag/snipp/" title="Snipp" rel="tag">Snipp</a>, <a href="http://www.undolog.com/tag/snippets/" title="Snippets" rel="tag">Snippets</a>, <a href="http://www.undolog.com/tag/stringwithcontentsofurl/" title="stringWithContentsOfURL" rel="tag">stringWithContentsOfURL</a>, <a href="http://www.undolog.com/category/sviluppo/" title="Sviluppo" rel="tag">Sviluppo</a><br />

	<h4>Post correlati</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.undolog.com/2009/10/09/very-short-snippet-iphone-numeri-casuali/" title="Very short snippet: iPhone, numeri casuali (9 ottobre, 2009)">Very short snippet: iPhone, numeri casuali</a> (0)</li>
	<li><a href="http://www.undolog.com/2008/11/19/very-short-snippet-wordpress-separare-le-categorie-in-due-colonne/" title="Very short snippet: Wordpress, separare le categorie in due colonne (19 novembre, 2008)">Very short snippet: Wordpress, separare le categorie in due colonne</a> (1)</li>
	<li><a href="http://www.undolog.com/2009/09/07/very-short-snippet-wordpress-migliorare-il-campo-cerca/" title="Very short snippet: Wordpress, migliorare il campo cerca (7 settembre, 2009)">Very short snippet: Wordpress, migliorare il campo cerca</a> (3)</li>
	<li><a href="http://www.undolog.com/2008/11/03/very-short-snippet-wordpress-administrator/" title="Very short snippet: Wordpress administrator? (3 novembre, 2008)">Very short snippet: Wordpress administrator?</a> (1)</li>
	<li><a href="http://www.undolog.com/2008/10/31/very-short-snippet-php-plain-date/" title="Very short snippet: PHP plain date (31 ottobre, 2008)">Very short snippet: PHP plain date</a> (1)</li>
</ul>

<img src="http://feeds.feedburner.com/~r/undolog/~4/BrI41qWDal0" height="1" width="1"/>]]></content:encoded><description>Avrei forse dovuto scrivere "Very very very, short snippet", tuttavia è un ottimo e comodissimo "trucchetto" questo che sto per mostrare. Eseguendo le "due" righe di codice indicate qui sotto, è possibile ottenere l'output di qualsiasi URL e manipolarlo.
PLAIN TEXT
Objective-C:




NSString *url = &amp;#91;NSString stringWithFormat:@&amp;#34;http://www.appleside.it/&amp;#34;&amp;#93;;


NSString *result = &amp;#91;NSString stringWithContentsOfURL:&amp;#91;NSURL URLWithString:url&amp;#93;


&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.undolog.com/2010/02/05/very-short-snippet-ottenere-loutput-di-un-url-in-objective-c/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://www.undolog.com/2010/02/05/very-short-snippet-ottenere-loutput-di-un-url-in-objective-c/</feedburner:origLink></item><item><title>AppleSide: iPad, Apple e molto altro</title><link>http://feedproxy.google.com/~r/undolog/~3/j6OfE8DOTc0/</link><category>Eventi &amp; Iniziative</category><category>Featured</category><category>iPad</category><category>Apple</category><category>AppleSide</category><category>Develop</category><category>Magazine</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Giovambattista Fazioli</dc:creator><pubDate>Thu, 28 Jan 2010 01:53:14 PST</pubDate><guid isPermaLink="false">http://www.undolog.com/?p=2861</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/YKLecyho7ky-n2A6Q0uVH1V_hbg/0/da"><img src="http://feedads.g.doubleclick.net/~a/YKLecyho7ky-n2A6Q0uVH1V_hbg/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/YKLecyho7ky-n2A6Q0uVH1V_hbg/1/da"><img src="http://feedads.g.doubleclick.net/~a/YKLecyho7ky-n2A6Q0uVH1V_hbg/1/di" border="0" ismap="true"></img></a></p><p><a href="http://www.appleside.it" target="_blank">AppleSide</a> è il nuovo magazine targato <a href="http://www.saidmade.com" target="_blank">Saidmade</a> dedicato all'universo Apple, presentato a ridosso della presentazione del nuovo <strong>Apple iPad</strong>. Sul magazine - con una taglio professionale - troverete moltissime news ed info dedicate alla mela morsicata: tra cui una sezione tutta dedicata al nuovissimo <strong>iPad</strong>! Inoltre sarà presente una sezione tutta dedicata allo sviluppo, curata dal sottoscritto. Con l'occasione, inauguro anche una nuova categoria qui su undolog, dedicata appunto all'Apple iPad. Sono riuscito già a provare le nuove SDK 3.2 beta - a causa della <acronym title="Nondisclosure agreement">NDA</acronym> vi posso svelare davvero poco - tuttavia vi consiglio di leggere <em><a href="http://www.appleside.it/develop/ipad-sdk-3-2-installazione-novita-prima-prova/" target="_blank">iPad SDK 3.2: installazione, novità, prima prova</a></em>, dove qualcosina sono riuscito a mostrare.</p>




	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F28%2Fappleside-ipad-apple-e-molto-altro%2F&amp;title=AppleSide%3A%20iPad%2C%20Apple%20e%20molto%20altro&amp;bodytext=Nasce%20il%20nuovo%20magazine%20dedicato%20all%27universo%20Apple%20e%20al%20nuovo%20iPad" title="Digg"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F28%2Fappleside-ipad-apple-e-molto-altro%2F&amp;title=AppleSide%3A%20iPad%2C%20Apple%20e%20molto%20altro&amp;notes=Nasce%20il%20nuovo%20magazine%20dedicato%20all%27universo%20Apple%20e%20al%20nuovo%20iPad" title="del.icio.us"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F28%2Fappleside-ipad-apple-e-molto-altro%2F" title="Technorati"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F28%2Fappleside-ipad-apple-e-molto-altro%2F&amp;t=AppleSide%3A%20iPad%2C%20Apple%20e%20molto%20altro" title="Facebook"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F28%2Fappleside-ipad-apple-e-molto-altro%2F&amp;title=AppleSide%3A%20iPad%2C%20Apple%20e%20molto%20altro&amp;annotation=Nasce%20il%20nuovo%20magazine%20dedicato%20all%27universo%20Apple%20e%20al%20nuovo%20iPad" title="Google Bookmarks"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=AppleSide%3A%20iPad%2C%20Apple%20e%20molto%20altro%20-%20http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F28%2Fappleside-ipad-apple-e-molto-altro%2F" title="Twitter"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://barrapunto.com/submit.pl?subj=AppleSide%3A%20iPad%2C%20Apple%20e%20molto%20altro&amp;story=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F28%2Fappleside-ipad-apple-e-molto-altro%2F" title="BarraPunto"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://current.com/clipper.htm?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F28%2Fappleside-ipad-apple-e-molto-altro%2F&amp;title=AppleSide%3A%20iPad%2C%20Apple%20e%20molto%20altro" title="Current"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/current.png" title="Current" alt="Current" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=AppleSide%3A%20iPad%2C%20Apple%20e%20molto%20altro&amp;body=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F28%2Fappleside-ipad-apple-e-molto-altro%2F" title="email"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=AppleSide%3A%20iPad%2C%20Apple%20e%20molto%20altro&amp;link=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F28%2Fappleside-ipad-apple-e-molto-altro%2F" title="FriendFeed"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://laaik.it/NewStoryCompact.aspx?uri=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F28%2Fappleside-ipad-apple-e-molto-altro%2F&amp;headline=AppleSide%3A%20iPad%2C%20Apple%20e%20molto%20altro&amp;cat=5e082fcc-8a3b-47e2-acec-fdf64ff19d12" title="laaik.it"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/laaikit.png" title="laaik.it" alt="laaik.it" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F28%2Fappleside-ipad-apple-e-molto-altro%2F&amp;title=AppleSide%3A%20iPad%2C%20Apple%20e%20molto%20altro&amp;source=Undolog.com+Research+%26amp%3B+Development++Blog&amp;summary=Nasce%20il%20nuovo%20magazine%20dedicato%20all%27universo%20Apple%20e%20al%20nuovo%20iPad" title="LinkedIn"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F28%2Fappleside-ipad-apple-e-molto-altro%2F&amp;title=AppleSide%3A%20iPad%2C%20Apple%20e%20molto%20altro" title="Live"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F28%2Fappleside-ipad-apple-e-molto-altro%2F&amp;t=AppleSide%3A%20iPad%2C%20Apple%20e%20molto%20altro" title="MySpace"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=AppleSide%3A%20iPad%2C%20Apple%20e%20molto%20altro&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F28%2Fappleside-ipad-apple-e-molto-altro%2F" title="Netvibes"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F28%2Fappleside-ipad-apple-e-molto-altro%2F&amp;partner=sociable" title="Print"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.undolog.com/feed/" title="RSS"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://segnalo.alice.it/post.html.php?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F28%2Fappleside-ipad-apple-e-molto-altro%2F&amp;title=AppleSide%3A%20iPad%2C%20Apple%20e%20molto%20altro" title="Segnalo"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/segnalo.png" title="Segnalo" alt="Segnalo" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F28%2Fappleside-ipad-apple-e-molto-altro%2F&amp;title=AppleSide%3A%20iPad%2C%20Apple%20e%20molto%20altro" title="StumbleUpon"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.wikio.it/vote?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F28%2Fappleside-ipad-apple-e-molto-altro%2F" title="Wikio IT"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/wikio.png" title="Wikio IT" alt="Wikio IT" class="sociable-hovers" /></a>


<br/><br/>
	Tags: <a href="http://www.undolog.com/tag/apple/" title="Apple" rel="tag">Apple</a>, <a href="http://www.undolog.com/tag/appleside/" title="AppleSide" rel="tag">AppleSide</a>, <a href="http://www.undolog.com/tag/develop/" title="Develop" rel="tag">Develop</a>, <a href="http://www.undolog.com/category/eventi-iniziative/" title="Eventi &amp; Iniziative" rel="tag">Eventi &amp; Iniziative</a>, <a href="http://www.undolog.com/category/featured/" title="Featured" rel="tag">Featured</a>, <a href="http://www.undolog.com/category/sviluppo/ipad/" title="iPad" rel="tag">iPad</a>, <a href="http://www.undolog.com/tag/ipad/" title="iPad" rel="tag">iPad</a>, <a href="http://www.undolog.com/tag/magazine/" title="Magazine" rel="tag">Magazine</a><br />

	<h4>Post correlati</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.undolog.com/2009/07/10/xcode-organizzare-il-codice-con-la-direttiva-pragma-mark/" title="XCode: organizzare il codice con la direttiva #pragma mark (10 luglio, 2009)">XCode: organizzare il codice con la direttiva #pragma mark</a> (0)</li>
	<li><a href="http://www.undolog.com/2009/07/20/xcode-consigli-sul-debugging-preferences/" title="XCode: consigli sul Debugging Preferences (20 luglio, 2009)">XCode: consigli sul Debugging Preferences</a> (0)</li>
	<li><a href="http://www.undolog.com/2009/07/23/xcode-shortcut/" title="Xcode shortcut (23 luglio, 2009)">Xcode shortcut</a> (0)</li>
	<li><a href="http://www.undolog.com/2007/01/26/windows-vista-caro-prezzi/" title="Windows Vista: caro prezzi (26 gennaio, 2007)">Windows Vista: caro prezzi</a> (1)</li>
	<li><a href="http://www.undolog.com/2007/02/13/web20-adobe-ci-prova-con-apollo/" title="Web2.0: Adobe ci prova con Apollo? (13 febbraio, 2007)">Web2.0: Adobe ci prova con Apollo?</a> (2)</li>
</ul>

<img src="http://feeds.feedburner.com/~r/undolog/~4/j6OfE8DOTc0" height="1" width="1"/>]]></content:encoded><description>Nasce il nuovo magazine dedicato all'universo Apple e al nuovo iPad</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.undolog.com/2010/01/28/appleside-ipad-apple-e-molto-altro/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">2</slash:comments><feedburner:origLink>http://www.undolog.com/2010/01/28/appleside-ipad-apple-e-molto-altro/</feedburner:origLink></item><item><title>Come selezionare un gruppo di tag che non hanno figli di un certo tipo</title><link>http://feedproxy.google.com/~r/undolog/~3/hffWAy0jgx8/</link><category>CSS</category><category>Internet</category><category>Javascript</category><category>Sviluppo</category><category>jQuery</category><category>addClass()</category><category>class</category><category>each()</category><category>link</category><category>NOT</category><category>Snipp</category><category>target</category><category>_blank</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Giovambattista Fazioli</dc:creator><pubDate>Tue, 26 Jan 2010 07:09:15 PST</pubDate><guid isPermaLink="false">http://www.undolog.com/?p=2852</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/9nR4DYxRR6vByAF3lCRHPerlz5g/0/da"><img src="http://feedads.g.doubleclick.net/~a/9nR4DYxRR6vByAF3lCRHPerlz5g/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/9nR4DYxRR6vByAF3lCRHPerlz5g/1/da"><img src="http://feedads.g.doubleclick.net/~a/9nR4DYxRR6vByAF3lCRHPerlz5g/1/di" border="0" ismap="true"></img></a></p><p><a target="_blank" href="http://jquery.com">jQuery</a> è giunto alla <strong>versione 1.4</strong>! Oltre a varie nuove features e la "solita" riscrittura del codice, tutta la <a target="_blank" href="http://api.jquery.com">documentazione</a> è stata rivista in maniera davvero più leggibile rispetto a prima. Ma vediamo alla questione di questo post; <strong>problema</strong>: aggiungere, tramite jQuery, una classe a tutti i tag <code>a</code> che possiedono l'attributo <code>target</code> impostato a <code>_blank</code>!<br />
Questo l'avevamo già visto in <em><a href="://www.undolog.com/2008/12/15/very-short-snippet-jquery-auto-target-blank-link/">Very short snippet: jQuery auto target blank link</a></em>. La questione è che spesso anche le immagini hanno un link ad una nuova finestra e aggiungere un'ulteriore immagine al bordo non è molto bello. Per far in modo che su particolare link non venga applicata la classe esistono due modi:</p>
<h4>Aggiungere una classe</h4>
<p>Il primo metodo, che vale con qualsiasi link, è quello di aggiungere una classe, ad esempio <code>noexternal</code>, a tutti quei link che, nonostante contengono l'attributo <code>target="_blank"</code>, non vogliamo mostrino l'immagine. In pratica vogliamo far in modo che jQuery non li prenda in considerazione.</p>
<div class="igBar"><span id="ljavascript-10"><a href="#" onclick="javascript:showCodeTxt('javascript-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-10">
<div class="javascript" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a[target=_blank]'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">not</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.noexternal'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'external'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Questo meotdo, seppur efficace, costringe comunque ad inserire nel link che vogliamo escludere la classe <code>noexternal</code>:</p>
<div class="igBar"><span id="lhtml-11"><a href="#" onclick="javascript:showCodeTxt('html-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-11">
<div class="html" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><a href="http://december.com/html/4/element/%26amp%3Blt%3CSEMI%3Ea.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">target</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;blank&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.undolog.com&quot;</span><a href="http://december.com/html/4/element/%26amp%3Bgt%3CSEMI%3E.html"><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>Link esterno con immagine<span style="color: #009900;"><a href="http://december.com/html/4/element/%26amp%3Blt%3CSEMI%3E%2Fa%26amp%3Bgt%3CSEMI%3E.html"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></a></span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><a href="http://december.com/html/4/element/%26amp%3Blt%3CSEMI%3Ea.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">target</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;blank&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;noexternal&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.appleside.it&quot;</span><a href="http://december.com/html/4/element/%26amp%3Bgt%3CSEMI%3E.html"><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>Link esterno senza immagine<span style="color: #009900;"><a href="http://december.com/html/4/element/%26amp%3Blt%3CSEMI%3E%2Fa%26amp%3Bgt%3CSEMI%3E.html"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></a></span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h4>Usare un ciclo each()</h4>
<p>In alternativa, per disabilitare l'uso della classe external su tutti quei link che contengono un'immagine, possiamo usare:</p>
<div class="igBar"><span id="ljavascript-12"><a href="#" onclick="javascript:showCodeTxt('javascript-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-12">
<div class="javascript" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a[target=_blank]:not(.noexternal)'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> me <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span>me<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">children</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'img'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">length</span><span style="color: #339933;">&gt;</span> <span style="color: #CC0000;color:#800000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$<span style="color: #009900;">&#40;</span>me<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'external'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Questa svolge la medesima funzione di quella precedente con l'aggiunta della verifica se il "primo" figlio è un'immagine. In caso affermativo la classe <code>external</code> non viene aggiunta al tag <code>a</code>.<br />
Sarebbe interessante capire se esiste un metodo per fare la stessa cosa senza usare un "ciclo" <code>each()</code>!</p>




	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fcome-selezionare-un-gruppo-di-tag-che-non-hanno-figli-di-un-certo-tipo%2F&amp;title=Come%20selezionare%20un%20gruppo%20di%20tag%20che%20non%20hanno%20figli%20di%20un%20certo%20tipo&amp;bodytext=jQuery%20%C3%A8%20giunto%20alla%20versione%201.4%21%20Oltre%20a%20varie%20nuove%20features%20e%20la%20%22solita%22%20riscrittura%20del%20codice%2C%20tutta%20la%20documentazione%20%C3%A8%20stata%20rivista%20in%20maniera%20davvero%20pi%C3%B9%20leggibile%20rispetto%20a%20prima.%20Ma%20vediamo%20alla%20questione%20di%20questo%20post%3B%20problema%3A%20ag" title="Digg"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fcome-selezionare-un-gruppo-di-tag-che-non-hanno-figli-di-un-certo-tipo%2F&amp;title=Come%20selezionare%20un%20gruppo%20di%20tag%20che%20non%20hanno%20figli%20di%20un%20certo%20tipo&amp;notes=jQuery%20%C3%A8%20giunto%20alla%20versione%201.4%21%20Oltre%20a%20varie%20nuove%20features%20e%20la%20%22solita%22%20riscrittura%20del%20codice%2C%20tutta%20la%20documentazione%20%C3%A8%20stata%20rivista%20in%20maniera%20davvero%20pi%C3%B9%20leggibile%20rispetto%20a%20prima.%20Ma%20vediamo%20alla%20questione%20di%20questo%20post%3B%20problema%3A%20ag" title="del.icio.us"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fcome-selezionare-un-gruppo-di-tag-che-non-hanno-figli-di-un-certo-tipo%2F" title="Technorati"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fcome-selezionare-un-gruppo-di-tag-che-non-hanno-figli-di-un-certo-tipo%2F&amp;t=Come%20selezionare%20un%20gruppo%20di%20tag%20che%20non%20hanno%20figli%20di%20un%20certo%20tipo" title="Facebook"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fcome-selezionare-un-gruppo-di-tag-che-non-hanno-figli-di-un-certo-tipo%2F&amp;title=Come%20selezionare%20un%20gruppo%20di%20tag%20che%20non%20hanno%20figli%20di%20un%20certo%20tipo&amp;annotation=jQuery%20%C3%A8%20giunto%20alla%20versione%201.4%21%20Oltre%20a%20varie%20nuove%20features%20e%20la%20%22solita%22%20riscrittura%20del%20codice%2C%20tutta%20la%20documentazione%20%C3%A8%20stata%20rivista%20in%20maniera%20davvero%20pi%C3%B9%20leggibile%20rispetto%20a%20prima.%20Ma%20vediamo%20alla%20questione%20di%20questo%20post%3B%20problema%3A%20ag" title="Google Bookmarks"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Come%20selezionare%20un%20gruppo%20di%20tag%20che%20non%20hanno%20figli%20di%20un%20certo%20tipo%20-%20http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fcome-selezionare-un-gruppo-di-tag-che-non-hanno-figli-di-un-certo-tipo%2F" title="Twitter"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://barrapunto.com/submit.pl?subj=Come%20selezionare%20un%20gruppo%20di%20tag%20che%20non%20hanno%20figli%20di%20un%20certo%20tipo&amp;story=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fcome-selezionare-un-gruppo-di-tag-che-non-hanno-figli-di-un-certo-tipo%2F" title="BarraPunto"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://current.com/clipper.htm?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fcome-selezionare-un-gruppo-di-tag-che-non-hanno-figli-di-un-certo-tipo%2F&amp;title=Come%20selezionare%20un%20gruppo%20di%20tag%20che%20non%20hanno%20figli%20di%20un%20certo%20tipo" title="Current"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/current.png" title="Current" alt="Current" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=Come%20selezionare%20un%20gruppo%20di%20tag%20che%20non%20hanno%20figli%20di%20un%20certo%20tipo&amp;body=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fcome-selezionare-un-gruppo-di-tag-che-non-hanno-figli-di-un-certo-tipo%2F" title="email"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Come%20selezionare%20un%20gruppo%20di%20tag%20che%20non%20hanno%20figli%20di%20un%20certo%20tipo&amp;link=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fcome-selezionare-un-gruppo-di-tag-che-non-hanno-figli-di-un-certo-tipo%2F" title="FriendFeed"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://laaik.it/NewStoryCompact.aspx?uri=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fcome-selezionare-un-gruppo-di-tag-che-non-hanno-figli-di-un-certo-tipo%2F&amp;headline=Come%20selezionare%20un%20gruppo%20di%20tag%20che%20non%20hanno%20figli%20di%20un%20certo%20tipo&amp;cat=5e082fcc-8a3b-47e2-acec-fdf64ff19d12" title="laaik.it"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/laaikit.png" title="laaik.it" alt="laaik.it" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fcome-selezionare-un-gruppo-di-tag-che-non-hanno-figli-di-un-certo-tipo%2F&amp;title=Come%20selezionare%20un%20gruppo%20di%20tag%20che%20non%20hanno%20figli%20di%20un%20certo%20tipo&amp;source=Undolog.com+Research+%26amp%3B+Development++Blog&amp;summary=jQuery%20%C3%A8%20giunto%20alla%20versione%201.4%21%20Oltre%20a%20varie%20nuove%20features%20e%20la%20%22solita%22%20riscrittura%20del%20codice%2C%20tutta%20la%20documentazione%20%C3%A8%20stata%20rivista%20in%20maniera%20davvero%20pi%C3%B9%20leggibile%20rispetto%20a%20prima.%20Ma%20vediamo%20alla%20questione%20di%20questo%20post%3B%20problema%3A%20ag" title="LinkedIn"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fcome-selezionare-un-gruppo-di-tag-che-non-hanno-figli-di-un-certo-tipo%2F&amp;title=Come%20selezionare%20un%20gruppo%20di%20tag%20che%20non%20hanno%20figli%20di%20un%20certo%20tipo" title="Live"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fcome-selezionare-un-gruppo-di-tag-che-non-hanno-figli-di-un-certo-tipo%2F&amp;t=Come%20selezionare%20un%20gruppo%20di%20tag%20che%20non%20hanno%20figli%20di%20un%20certo%20tipo" title="MySpace"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Come%20selezionare%20un%20gruppo%20di%20tag%20che%20non%20hanno%20figli%20di%20un%20certo%20tipo&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fcome-selezionare-un-gruppo-di-tag-che-non-hanno-figli-di-un-certo-tipo%2F" title="Netvibes"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fcome-selezionare-un-gruppo-di-tag-che-non-hanno-figli-di-un-certo-tipo%2F&amp;partner=sociable" title="Print"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.undolog.com/feed/" title="RSS"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://segnalo.alice.it/post.html.php?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fcome-selezionare-un-gruppo-di-tag-che-non-hanno-figli-di-un-certo-tipo%2F&amp;title=Come%20selezionare%20un%20gruppo%20di%20tag%20che%20non%20hanno%20figli%20di%20un%20certo%20tipo" title="Segnalo"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/segnalo.png" title="Segnalo" alt="Segnalo" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fcome-selezionare-un-gruppo-di-tag-che-non-hanno-figli-di-un-certo-tipo%2F&amp;title=Come%20selezionare%20un%20gruppo%20di%20tag%20che%20non%20hanno%20figli%20di%20un%20certo%20tipo" title="StumbleUpon"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.wikio.it/vote?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fcome-selezionare-un-gruppo-di-tag-che-non-hanno-figli-di-un-certo-tipo%2F" title="Wikio IT"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/wikio.png" title="Wikio IT" alt="Wikio IT" class="sociable-hovers" /></a>


<br/><br/>
	Tags: <a href="http://www.undolog.com/tag/addclass/" title="addClass()" rel="tag">addClass()</a>, <a href="http://www.undolog.com/tag/class/" title="class" rel="tag">class</a>, <a href="http://www.undolog.com/category/sviluppo/internet/css/" title="CSS" rel="tag">CSS</a>, <a href="http://www.undolog.com/tag/each/" title="each()" rel="tag">each()</a>, <a href="http://www.undolog.com/category/sviluppo/internet/" title="Internet" rel="tag">Internet</a>, <a href="http://www.undolog.com/category/sviluppo/internet/javascript/" title="Javascript" rel="tag">Javascript</a>, <a href="http://www.undolog.com/tag/jquery/" title="jQuery" rel="tag">jQuery</a>, <a href="http://www.undolog.com/category/sviluppo/internet/javascript/jquery-javascript-internet-sviluppo/" title="jQuery" rel="tag">jQuery</a>, <a href="http://www.undolog.com/tag/link/" title="link" rel="tag">link</a>, <a href="http://www.undolog.com/tag/not/" title="NOT" rel="tag">NOT</a>, <a href="http://www.undolog.com/tag/snipp/" title="Snipp" rel="tag">Snipp</a>, <a href="http://www.undolog.com/category/sviluppo/" title="Sviluppo" rel="tag">Sviluppo</a>, <a href="http://www.undolog.com/tag/target/" title="target" rel="tag">target</a>, <a href="http://www.undolog.com/tag/_blank/" title="_blank" rel="tag">_blank</a><br />

	<h4>Post correlati</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.undolog.com/2008/12/15/very-short-snippet-jquery-auto-target-blank-link/" title="Very short snippet: jQuery auto target blank link (15 dicembre, 2008)">Very short snippet: jQuery auto target blank link</a> (3)</li>
	<li><a href="http://www.undolog.com/2009/02/09/wordpress-personalizzare-la-navigazione-tra-i-post/" title="Wordpress: personalizzare la navigazione tra i post (9 febbraio, 2009)">Wordpress: personalizzare la navigazione tra i post</a> (5)</li>
	<li><a href="http://www.undolog.com/2008/10/17/wordpress-modifcare-adminbigwidth-per-gli-sviluppatori/" title="Wordpress: modifcare AdminBigWidth per gli sviluppatori (17 ottobre, 2008)">Wordpress: modifcare AdminBigWidth per gli sviluppatori</a> (1)</li>
	<li><a href="http://www.undolog.com/2008/10/22/wordpress-migliorare-la-lista-dei-commenti/" title="Wordpress: migliorare la lista dei commenti (22 ottobre, 2008)">Wordpress: migliorare la lista dei commenti</a> (3)</li>
	<li><a href="http://www.undolog.com/2009/07/02/wordpress-eliminare-i-post-duplicati-nei-loop-multipli/" title="Wordpress: eliminare i post duplicati nei loop multipli (2 luglio, 2009)">Wordpress: eliminare i post duplicati nei loop multipli</a> (3)</li>
</ul>

<img src="http://feeds.feedburner.com/~r/undolog/~4/hffWAy0jgx8" height="1" width="1"/>]]></content:encoded><description>jQuery è giunto alla versione 1.4! Oltre a varie nuove features e la "solita" riscrittura del codice, tutta la documentazione è stata rivista in maniera davvero più leggibile rispetto a prima. Ma vediamo alla questione di questo post; problema: aggiungere, tramite jQuery, una classe a tutti i tag a che possiedono l'attributo target impostato a [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.undolog.com/2010/01/26/come-selezionare-un-gruppo-di-tag-che-non-hanno-figli-di-un-certo-tipo/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://www.undolog.com/2010/01/26/come-selezionare-un-gruppo-di-tag-che-non-hanno-figli-di-un-certo-tipo/</feedburner:origLink></item><item><title>Wordpress: estendere le informazioni utente</title><link>http://feedproxy.google.com/~r/undolog/~3/UdkRxVbf4sY/</link><category>Internet</category><category>PHP</category><category>Sviluppo</category><category>WordPress</category><category>add_action()</category><category>functions.php</category><category>get_the_author_meta()</category><category>Template</category><category>the_author_meta()</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Giovambattista Fazioli</dc:creator><pubDate>Mon, 25 Jan 2010 15:18:54 PST</pubDate><guid isPermaLink="false">http://www.undolog.com/?p=2842</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/Uze8fDniPJmgWDRK29BGwU9xr-M/0/da"><img src="http://feedads.g.doubleclick.net/~a/Uze8fDniPJmgWDRK29BGwU9xr-M/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Uze8fDniPJmgWDRK29BGwU9xr-M/1/da"><img src="http://feedads.g.doubleclick.net/~a/Uze8fDniPJmgWDRK29BGwU9xr-M/1/di" border="0" ismap="true"></img></a></p><p>Le informazioni su un utente, o autore, di un blog Wordpress possono essere <strong>estese</strong> in modo semplice. Potrebbe ad esempio essere utile inserire la data di nascita, delle informazioni bibliografiche, l'indirizzo della sede di lavoro o, estremamente comodo, un campo per dei <strong>permessi speciali</strong> - da controllare in seguito nel template.<br />
L'operazione che ci accingiamo a fare non necessita di un Plugin, ma il codice che serve può essere posizionato nel - consueto - file <code>functions.php</code>.</p>
<blockquote><p><strong>Nota</strong>: per situazioni più articolate l'uso di un Plugin potrebbe essere la scelta migliore. Agendo sul file <code>functions.php</code> leghiamo il nostro codice al tema. Un Plugin, soprattutto se il codice scritto è "abbondante", risulta di più facile riutilizzo.</p></blockquote>
<p>Apriamo dunque il file <code>functions.php</code> e iniziamo scrivendo il codice che visualizzerà il nostro campo aggiuntivo nell'amministrazione utente di Wordpress:</p>
<div class="igBar"><span id="lphp-16"><a href="#" onclick="javascript:showCodeTxt('php-16'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-16">
<div class="php" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">// Questa funzione - vedi add_action() più sotto, si occupa di visualizzare</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">// il nostro campo aggiuntiva nell'amministrazione di Wordpress</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">function nuovo_user_meta($user) { ?&gt;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &lt;h3&gt;Campi aggiuntivi&lt;/h3&gt;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;table class=&quot;form-table&quot;&gt;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;th&gt;&lt;label for=&quot;nuovo_user_meta&quot;&gt;Nuovo Campo&lt;/label&gt;&lt;/th&gt;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;td&gt;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input type=&quot;text&quot; name=&quot;nuovo_user_meta&quot; id=&quot;nuovo_user_meta&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> esc_attr<span style="color: #009900;">&#40;</span> get_the_author_meta<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'nuovo_user_meta'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; class=&quot;regular-text&quot; /&gt;&lt;br /&gt;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;span class=&quot;description&quot;&gt;Inserisci il tuo campo aggiuntivo.&lt;/span&gt;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/td&gt;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/tr&gt;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/table&gt;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// Aggiungiamo la nostra funzione all'amministrazione di Wordpress</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// in questo &quot;semplice&quot; caso, la funzione &quot;mostra&quot; (show_user_profile)</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// e quella di &quot;modifica&quot; (edit_user_profile) coincidono, ma in casi</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// più articolati potrebbero essere differenti</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'show_user_profile'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'nuovo_user_meta'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'edit_user_profile'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'nuovo_user_meta'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Andando a sbirciare nell'amministrazione, selezionando il vostro utente, troverete già il nuovo campo. Tuttavia per adesso il nuovo campo è solo visualizzato, ma basteranno poche altre righe di codice per gestire la sua memorizzazione:</p>
<div class="igBar"><span id="lphp-17"><a href="#" onclick="javascript:showCodeTxt('php-17'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-17">
<div class="php" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// Memorizza, per l'utente $user_id, un nuovo campo identificato come</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// 'nuovo_user_meta'</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">function</span> nuovo_user_meta_update<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$user_id</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// solo chi ha i permessi di editing </span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span>current_user_can<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'edit_user'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$user_id</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">/* Copy and paste this line for additional fields. Make sure to change 'twitter' to the field ID. */</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; update_usermeta<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$user_id</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'nuovo_user_meta'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'nuovo_user_meta'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// Anche in questo caso ci avvaliamo della add_action() per aggiungere</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// il nostro pezzo di codice. Notate che permettiamo l'aggiornamento</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// sia all'utente che visualizza il proprio profilo (personal_options_update) </span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// che a qualsiasi utente amministratore o che ha i permessi di edit (edit_user_profile_update)</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'personal_options_update'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'nuovo_user_meta_update'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'edit_user_profile_update'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'nuovo_user_meta_update'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
A questo punto il nostro campo aggiuntivo è completo e non resta altro che utilizzarlo. Per recuperare un campo di questo tipo è sufficiente chiamare la funzione <code>get_the_author_meta()</code> o <code>the_author_meta()</code>:</p>
<div class="igBar"><span id="lphp-18"><a href="#" onclick="javascript:showCodeTxt('php-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-18">
<div class="php" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&lt;p&gt;Campo Aggiuntivo: <span style="color: #000000; font-weight: bold;">&lt;?php</span> the_author_meta<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'nuovo_user_meta'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/p&gt;</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>




	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fwordpress-estendere-le-informazioni-utente%2F&amp;title=Wordpress%3A%20estendere%20le%20informazioni%20utente&amp;bodytext=Le%20informazioni%20su%20un%20utente%2C%20o%20autore%2C%20di%20un%20blog%20Wordpress%20possono%20essere%20estese%20in%20modo%20semplice.%20Potrebbe%20ad%20esempio%20essere%20utile%20inserire%20la%20data%20di%20nascita%2C%20delle%20informazioni%20bibliografiche%2C%20l%27indirizzo%20della%20sede%20di%20lavoro%20o%2C%20estremamente%20com" title="Digg"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fwordpress-estendere-le-informazioni-utente%2F&amp;title=Wordpress%3A%20estendere%20le%20informazioni%20utente&amp;notes=Le%20informazioni%20su%20un%20utente%2C%20o%20autore%2C%20di%20un%20blog%20Wordpress%20possono%20essere%20estese%20in%20modo%20semplice.%20Potrebbe%20ad%20esempio%20essere%20utile%20inserire%20la%20data%20di%20nascita%2C%20delle%20informazioni%20bibliografiche%2C%20l%27indirizzo%20della%20sede%20di%20lavoro%20o%2C%20estremamente%20com" title="del.icio.us"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fwordpress-estendere-le-informazioni-utente%2F" title="Technorati"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fwordpress-estendere-le-informazioni-utente%2F&amp;t=Wordpress%3A%20estendere%20le%20informazioni%20utente" title="Facebook"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fwordpress-estendere-le-informazioni-utente%2F&amp;title=Wordpress%3A%20estendere%20le%20informazioni%20utente&amp;annotation=Le%20informazioni%20su%20un%20utente%2C%20o%20autore%2C%20di%20un%20blog%20Wordpress%20possono%20essere%20estese%20in%20modo%20semplice.%20Potrebbe%20ad%20esempio%20essere%20utile%20inserire%20la%20data%20di%20nascita%2C%20delle%20informazioni%20bibliografiche%2C%20l%27indirizzo%20della%20sede%20di%20lavoro%20o%2C%20estremamente%20com" title="Google Bookmarks"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Wordpress%3A%20estendere%20le%20informazioni%20utente%20-%20http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fwordpress-estendere-le-informazioni-utente%2F" title="Twitter"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://barrapunto.com/submit.pl?subj=Wordpress%3A%20estendere%20le%20informazioni%20utente&amp;story=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fwordpress-estendere-le-informazioni-utente%2F" title="BarraPunto"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://current.com/clipper.htm?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fwordpress-estendere-le-informazioni-utente%2F&amp;title=Wordpress%3A%20estendere%20le%20informazioni%20utente" title="Current"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/current.png" title="Current" alt="Current" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=Wordpress%3A%20estendere%20le%20informazioni%20utente&amp;body=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fwordpress-estendere-le-informazioni-utente%2F" title="email"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Wordpress%3A%20estendere%20le%20informazioni%20utente&amp;link=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fwordpress-estendere-le-informazioni-utente%2F" title="FriendFeed"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://laaik.it/NewStoryCompact.aspx?uri=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fwordpress-estendere-le-informazioni-utente%2F&amp;headline=Wordpress%3A%20estendere%20le%20informazioni%20utente&amp;cat=5e082fcc-8a3b-47e2-acec-fdf64ff19d12" title="laaik.it"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/laaikit.png" title="laaik.it" alt="laaik.it" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fwordpress-estendere-le-informazioni-utente%2F&amp;title=Wordpress%3A%20estendere%20le%20informazioni%20utente&amp;source=Undolog.com+Research+%26amp%3B+Development++Blog&amp;summary=Le%20informazioni%20su%20un%20utente%2C%20o%20autore%2C%20di%20un%20blog%20Wordpress%20possono%20essere%20estese%20in%20modo%20semplice.%20Potrebbe%20ad%20esempio%20essere%20utile%20inserire%20la%20data%20di%20nascita%2C%20delle%20informazioni%20bibliografiche%2C%20l%27indirizzo%20della%20sede%20di%20lavoro%20o%2C%20estremamente%20com" title="LinkedIn"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fwordpress-estendere-le-informazioni-utente%2F&amp;title=Wordpress%3A%20estendere%20le%20informazioni%20utente" title="Live"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fwordpress-estendere-le-informazioni-utente%2F&amp;t=Wordpress%3A%20estendere%20le%20informazioni%20utente" title="MySpace"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Wordpress%3A%20estendere%20le%20informazioni%20utente&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fwordpress-estendere-le-informazioni-utente%2F" title="Netvibes"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fwordpress-estendere-le-informazioni-utente%2F&amp;partner=sociable" title="Print"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.undolog.com/feed/" title="RSS"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://segnalo.alice.it/post.html.php?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fwordpress-estendere-le-informazioni-utente%2F&amp;title=Wordpress%3A%20estendere%20le%20informazioni%20utente" title="Segnalo"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/segnalo.png" title="Segnalo" alt="Segnalo" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fwordpress-estendere-le-informazioni-utente%2F&amp;title=Wordpress%3A%20estendere%20le%20informazioni%20utente" title="StumbleUpon"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.wikio.it/vote?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F26%2Fwordpress-estendere-le-informazioni-utente%2F" title="Wikio IT"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/wikio.png" title="Wikio IT" alt="Wikio IT" class="sociable-hovers" /></a>


<br/><br/>
	Tags: <a href="http://www.undolog.com/tag/add_action/" title="add_action()" rel="tag">add_action()</a>, <a href="http://www.undolog.com/tag/functionsphp/" title="functions.php" rel="tag">functions.php</a>, <a href="http://www.undolog.com/tag/get_the_author_meta/" title="get_the_author_meta()" rel="tag">get_the_author_meta()</a>, <a href="http://www.undolog.com/category/sviluppo/internet/" title="Internet" rel="tag">Internet</a>, <a href="http://www.undolog.com/category/sviluppo/internet/php/" title="PHP" rel="tag">PHP</a>, <a href="http://www.undolog.com/tag/php/" title="PHP" rel="tag">PHP</a>, <a href="http://www.undolog.com/category/sviluppo/" title="Sviluppo" rel="tag">Sviluppo</a>, <a href="http://www.undolog.com/tag/template/" title="Template" rel="tag">Template</a>, <a href="http://www.undolog.com/tag/the_author_meta/" title="the_author_meta()" rel="tag">the_author_meta()</a>, <a href="http://www.undolog.com/category/sviluppo/internet/wordpress/" title="WordPress" rel="tag">WordPress</a>, <a href="http://www.undolog.com/tag/wordpress/" title="WordPress" rel="tag">WordPress</a><br />

	<h4>Post correlati</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.undolog.com/2009/07/03/wordpress-usare-gli-shortcodes/" title="Wordpress: usare gli shortcodes (3 luglio, 2009)">Wordpress: usare gli shortcodes</a> (5)</li>
	<li><a href="http://www.undolog.com/2008/11/01/wordpress-rimuovere-i-menu-dellamministrazione/" title="Wordpress: rimuovere i menu dell&#8217;amministrazione (1 novembre, 2008)">Wordpress: rimuovere i menu dell&#8217;amministrazione</a> (12)</li>
	<li><a href="http://www.undolog.com/2009/02/09/wordpress-personalizzare-la-navigazione-tra-i-post/" title="Wordpress: personalizzare la navigazione tra i post (9 febbraio, 2009)">Wordpress: personalizzare la navigazione tra i post</a> (5)</li>
	<li><a href="http://www.undolog.com/2008/10/22/wordpress-migliorare-la-lista-dei-commenti/" title="Wordpress: migliorare la lista dei commenti (22 ottobre, 2008)">Wordpress: migliorare la lista dei commenti</a> (3)</li>
	<li><a href="http://www.undolog.com/2009/01/16/wordpress-functionsphp-qualche-funzione-utile/" title="Wordpress: functions.php, qualche funzione utile (16 gennaio, 2009)">Wordpress: functions.php, qualche funzione utile</a> (0)</li>
</ul>

<img src="http://feeds.feedburner.com/~r/undolog/~4/UdkRxVbf4sY" height="1" width="1"/>]]></content:encoded><description>Le informazioni su un utente, o autore, di un blog Wordpress possono essere estese in modo semplice. Potrebbe ad esempio essere utile inserire la data di nascita, delle informazioni bibliografiche, l'indirizzo della sede di lavoro o, estremamente comodo, un campo per dei permessi speciali - da controllare in seguito nel template.
L'operazione che ci accingiamo a [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.undolog.com/2010/01/26/wordpress-estendere-le-informazioni-utente/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://www.undolog.com/2010/01/26/wordpress-estendere-le-informazioni-utente/</feedburner:origLink></item><item><title>Apple Event: Radiopodcast Live</title><link>http://feedproxy.google.com/~r/undolog/~3/n0EyT4GxcJ4/</link><category>Eventi &amp; Iniziative</category><category>Featured</category><category>Tecnologia</category><category>Apple</category><category>eventi</category><category>Keynote</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Giovambattista Fazioli</dc:creator><pubDate>Fri, 22 Jan 2010 17:18:21 PST</pubDate><guid isPermaLink="false">http://www.undolog.com/?p=2829</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/5Z1JCkAgNevh5th2_ijhAD_4P7E/0/da"><img src="http://feedads.g.doubleclick.net/~a/5Z1JCkAgNevh5th2_ijhAD_4P7E/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/5Z1JCkAgNevh5th2_ijhAD_4P7E/1/da"><img src="http://feedads.g.doubleclick.net/~a/5Z1JCkAgNevh5th2_ijhAD_4P7E/1/di" border="0" ismap="true"></img></a></p><p style="text-align: center;"><strong><a href="http://www.radiopodcastlive.net/livenow/">Mercoledì, 27 gennaio 2010 ore 18:30</a></strong></p>
<p class="center"><object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/Iz24nRhNU4Y&#038;hl=it_IT&#038;fs=1&#038;rel=0&#038;hd=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Iz24nRhNU4Y&#038;hl=it_IT&#038;fs=1&#038;rel=0&#038;hd=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object></p>




	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F23%2Fapple-event-radiopodcast-live%2F&amp;title=Apple%20Event%3A%20Radiopodcast%20Live&amp;bodytext=Frank%20con%20il%20supporto%20indispensabile%20di%20Kiro%20daranno%20vita%20il%20prossimo%2027%20gennaio%20alla%20diretta%20contemporanea%20del%20Keynote%20Apple%20proprio%20sulle%20%E2%80%9Cfrequenze%E2%80%9D%20di%20Radiopodcast." title="Digg"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F23%2Fapple-event-radiopodcast-live%2F&amp;title=Apple%20Event%3A%20Radiopodcast%20Live&amp;notes=Frank%20con%20il%20supporto%20indispensabile%20di%20Kiro%20daranno%20vita%20il%20prossimo%2027%20gennaio%20alla%20diretta%20contemporanea%20del%20Keynote%20Apple%20proprio%20sulle%20%E2%80%9Cfrequenze%E2%80%9D%20di%20Radiopodcast." title="del.icio.us"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F23%2Fapple-event-radiopodcast-live%2F" title="Technorati"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F23%2Fapple-event-radiopodcast-live%2F&amp;t=Apple%20Event%3A%20Radiopodcast%20Live" title="Facebook"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F23%2Fapple-event-radiopodcast-live%2F&amp;title=Apple%20Event%3A%20Radiopodcast%20Live&amp;annotation=Frank%20con%20il%20supporto%20indispensabile%20di%20Kiro%20daranno%20vita%20il%20prossimo%2027%20gennaio%20alla%20diretta%20contemporanea%20del%20Keynote%20Apple%20proprio%20sulle%20%E2%80%9Cfrequenze%E2%80%9D%20di%20Radiopodcast." title="Google Bookmarks"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Apple%20Event%3A%20Radiopodcast%20Live%20-%20http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F23%2Fapple-event-radiopodcast-live%2F" title="Twitter"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://barrapunto.com/submit.pl?subj=Apple%20Event%3A%20Radiopodcast%20Live&amp;story=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F23%2Fapple-event-radiopodcast-live%2F" title="BarraPunto"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://current.com/clipper.htm?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F23%2Fapple-event-radiopodcast-live%2F&amp;title=Apple%20Event%3A%20Radiopodcast%20Live" title="Current"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/current.png" title="Current" alt="Current" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=Apple%20Event%3A%20Radiopodcast%20Live&amp;body=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F23%2Fapple-event-radiopodcast-live%2F" title="email"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Apple%20Event%3A%20Radiopodcast%20Live&amp;link=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F23%2Fapple-event-radiopodcast-live%2F" title="FriendFeed"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://laaik.it/NewStoryCompact.aspx?uri=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F23%2Fapple-event-radiopodcast-live%2F&amp;headline=Apple%20Event%3A%20Radiopodcast%20Live&amp;cat=5e082fcc-8a3b-47e2-acec-fdf64ff19d12" title="laaik.it"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/laaikit.png" title="laaik.it" alt="laaik.it" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F23%2Fapple-event-radiopodcast-live%2F&amp;title=Apple%20Event%3A%20Radiopodcast%20Live&amp;source=Undolog.com+Research+%26amp%3B+Development++Blog&amp;summary=Frank%20con%20il%20supporto%20indispensabile%20di%20Kiro%20daranno%20vita%20il%20prossimo%2027%20gennaio%20alla%20diretta%20contemporanea%20del%20Keynote%20Apple%20proprio%20sulle%20%E2%80%9Cfrequenze%E2%80%9D%20di%20Radiopodcast." title="LinkedIn"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F23%2Fapple-event-radiopodcast-live%2F&amp;title=Apple%20Event%3A%20Radiopodcast%20Live" title="Live"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F23%2Fapple-event-radiopodcast-live%2F&amp;t=Apple%20Event%3A%20Radiopodcast%20Live" title="MySpace"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Apple%20Event%3A%20Radiopodcast%20Live&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F23%2Fapple-event-radiopodcast-live%2F" title="Netvibes"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F23%2Fapple-event-radiopodcast-live%2F&amp;partner=sociable" title="Print"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.undolog.com/feed/" title="RSS"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://segnalo.alice.it/post.html.php?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F23%2Fapple-event-radiopodcast-live%2F&amp;title=Apple%20Event%3A%20Radiopodcast%20Live" title="Segnalo"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/segnalo.png" title="Segnalo" alt="Segnalo" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F23%2Fapple-event-radiopodcast-live%2F&amp;title=Apple%20Event%3A%20Radiopodcast%20Live" title="StumbleUpon"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.wikio.it/vote?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F23%2Fapple-event-radiopodcast-live%2F" title="Wikio IT"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/wikio.png" title="Wikio IT" alt="Wikio IT" class="sociable-hovers" /></a>


<br/><br/>
	Tags: <a href="http://www.undolog.com/tag/apple/" title="Apple" rel="tag">Apple</a>, <a href="http://www.undolog.com/tag/eventi/" title="eventi" rel="tag">eventi</a>, <a href="http://www.undolog.com/category/eventi-iniziative/" title="Eventi &amp; Iniziative" rel="tag">Eventi &amp; Iniziative</a>, <a href="http://www.undolog.com/category/featured/" title="Featured" rel="tag">Featured</a>, <a href="http://www.undolog.com/tag/keynote/" title="Keynote" rel="tag">Keynote</a>, <a href="http://www.undolog.com/category/tecnologia/" title="Tecnologia" rel="tag">Tecnologia</a><br />

	<h4>Post correlati</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.undolog.com/2009/07/10/xcode-organizzare-il-codice-con-la-direttiva-pragma-mark/" title="XCode: organizzare il codice con la direttiva #pragma mark (10 luglio, 2009)">XCode: organizzare il codice con la direttiva #pragma mark</a> (0)</li>
	<li><a href="http://www.undolog.com/2009/07/20/xcode-consigli-sul-debugging-preferences/" title="XCode: consigli sul Debugging Preferences (20 luglio, 2009)">XCode: consigli sul Debugging Preferences</a> (0)</li>
	<li><a href="http://www.undolog.com/2009/07/23/xcode-shortcut/" title="Xcode shortcut (23 luglio, 2009)">Xcode shortcut</a> (0)</li>
	<li><a href="http://www.undolog.com/2007/01/26/windows-vista-caro-prezzi/" title="Windows Vista: caro prezzi (26 gennaio, 2007)">Windows Vista: caro prezzi</a> (1)</li>
	<li><a href="http://www.undolog.com/2007/02/13/web20-adobe-ci-prova-con-apollo/" title="Web2.0: Adobe ci prova con Apollo? (13 febbraio, 2007)">Web2.0: Adobe ci prova con Apollo?</a> (2)</li>
</ul>

<img src="http://feeds.feedburner.com/~r/undolog/~4/n0EyT4GxcJ4" height="1" width="1"/>]]></content:encoded><description>Frank con il supporto indispensabile di Kiro daranno vita il prossimo 27 gennaio alla diretta contemporanea del Keynote Apple proprio sulle “frequenze” di Radiopodcast.</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.undolog.com/2010/01/23/apple-event-radiopodcast-live/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://www.undolog.com/2010/01/23/apple-event-radiopodcast-live/</feedburner:origLink></item><item><title>FireFox 3.5.7: come risolvere il difetto dei bordi arrotondati su un’immagine</title><link>http://feedproxy.google.com/~r/undolog/~3/rv5QhQG6ke4/</link><category>CSS</category><category>Internet</category><category>Sviluppo</category><category>-moz-border-radius</category><category>-webkit-border-radius</category><category>border-radius</category><category>browser</category><category>Chrome</category><category>Compatibilità</category><category>firefox</category><category>google</category><category>IMG</category><category>Immagini</category><category>Mozilla</category><category>Safari</category><category>Snipp</category><category>Web</category><category>WebKit</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Giovambattista Fazioli</dc:creator><pubDate>Wed, 20 Jan 2010 14:41:26 PST</pubDate><guid isPermaLink="false">http://www.undolog.com/?p=2809</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/Wx0RFahHf9jA_iJ7eSzVu7lHfNs/0/da"><img src="http://feedads.g.doubleclick.net/~a/Wx0RFahHf9jA_iJ7eSzVu7lHfNs/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Wx0RFahHf9jA_iJ7eSzVu7lHfNs/1/da"><img src="http://feedads.g.doubleclick.net/~a/Wx0RFahHf9jA_iJ7eSzVu7lHfNs/1/di" border="0" ismap="true"></img></a></p><p>A volte basta spostare un elemento, cambiando punto di vista, per risolvere un problema apparentemente insuperabile. Quando poi si ha a che fare con compatibilità tra i browser e CSS, inventarsi soluzioni "spettacolari" (acrobazie direi) è all'ordine del giorno. Quello che vi mostro è un modo semplice per applicare bordi arrotondati a delle immagini utilizzando <code>-moz-border-radius</code>, disponibile per Mozilla FireFox e <code>-webkit-border-radius</code>, per Safari e Google Chrome.<br />
Normalmente questi attributi CSS vengono applicati a <em>container</em> come il <code>div</code>:</p>
<div class="igBar"><span id="lcss-24"><a href="#" onclick="javascript:showCodeTxt('css-24'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-24">
<div class="css" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">div<span style="color: #cc00cc;">#box</span> <span style="color: #00AA00;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">100px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">100px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; -moz-border-radius<span style="color: #00AA00;">:</span><span style="color: #933;">16px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; -webkit-border-radius<span style="color: #00AA00;">:</span><span style="color: #933;">16px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#eee</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#666</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #00AA00;">&#125;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Con codice HTML del tipo:</p>
<div class="igBar"><span id="lhtml-25"><a href="#" onclick="javascript:showCodeTxt('html-25'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-25">
<div class="html" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><a href="http://december.com/html/4/element/%26amp%3Blt%3CSEMI%3Ediv.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;box&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span>div&gt;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Ottenendo:</p>
<p class="center"><img src="http://www.undolog.com/wp-content/uploads/2010/01/Schermata-2010-01-20-a-21.47.18.png" alt="" title="Schermata 2010-01-20 a 21.47.18" width="114" height="114"  /></p>
<p>Volendo fare la stessa cosa su un'immagine, ci si accorge che il risultato è parzialmente raggiunto! Utilizzando un CSS di questo tipo:</p>
<div class="igBar"><span id="lcss-26"><a href="#" onclick="javascript:showCodeTxt('css-26'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-26">
<div class="css" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">img<span style="color: #cc00cc;">#round-</span><span style="color: #000000; font-weight: bold;">border</span> <span style="color: #00AA00;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; -moz-border-radius<span style="color: #00AA00;">:</span><span style="color: #933;">8px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; -webkit-border-radius<span style="color: #00AA00;">:</span><span style="color: #933;">8px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#eee</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#666</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #00AA00;">&#125;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Su una formattazione HTML come questa:</p>
<div class="igBar"><span id="lhtml-27"><a href="#" onclick="javascript:showCodeTxt('html-27'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-27">
<div class="html" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><a href="http://december.com/html/4/element/%26amp%3Blt%3CSEMI%3Eimg.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;round-border&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/undolog.png&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Round Image Test&quot;</span> <span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/%26amp%3Bgt%3CSEMI%3E.html"><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Safari e Google Chrome rispondono bene:</p>
<p class="center"><img src="http://www.undolog.com/wp-content/uploads/2010/01/Schermata-2010-01-20-a-21.55.29.png" alt="" title="Schermata 2010-01-20 a 21.55.29" width="65" height="65" /></p>
<p>Mentre FireFox stupisce mostrando:</p>
<p class="center"><img src="http://www.undolog.com/wp-content/uploads/2010/01/Schermata-2010-01-20-a-21.57.08.png" alt="" title="Schermata 2010-01-20 a 21.57.08" width="62" height="62" /></p>
<p>Com'è possibile vedere dallo screenshot qui sopra, in FireFox 3.5.7 il bordo "arrotondato" sembra esserci ma l'immagine è rimasta squadrata!<br />
Un semplice espediente - utile in particolari casi - permette di risolvere agevolmente il problema:</p>
<div class="igBar"><span id="lcss-28"><a href="#" onclick="javascript:showCodeTxt('css-28'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-28">
<div class="css" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">div<span style="color: #cc00cc;">#box</span> <span style="color: #00AA00;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; -moz-border-radius<span style="color: #00AA00;">:</span><span style="color: #933;">8px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; -webkit-border-radius<span style="color: #00AA00;">:</span><span style="color: #933;">8px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">http://dominio.com/images/undolog.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#666</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #00AA00;">&#125;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
In pratica invece di utilizzare direttamente il tag <code>img</code>, sfruttiamo un contenitore qualsiasi - in questo caso un <code>div</code> - impostando il suo sfondo con l'immagine che vogliamo visualizzare con i bordi arrotondati.<br />
Questa soluzione ha ovviamente una serie di inconvenienti:</p>
<ol style="list-style: decimal">
<li>Abbiamo perso il tag <code>img</code> (con il suo attributo <code>alt</code>), di conseguenza nel DOM html non esiste nessuna immagine, il ché significa che eliminando i fogli di stile la nostra immagine scompare</li>
<li>Dovendo definire un contenitore (nel nostro caso un <code>div</code>) tramite i fogli di stile, dobbiamo conoscere in partenza la sua dimensione</li>
</ol>
<p>Come ho più volte scritto su questo blog sarebbe proprio il caso che lo "standard" CSS (2 o 3 che sia) modificasse il suo nome in "ognuno fa quello che gli pare" ...</p>




	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F21%2Ffirefox-3-5-7-come-risolvere-il-difetto-dei-bordi-arrotondati-su-unimmagine%2F&amp;title=FireFox%203.5.7%3A%20come%20risolvere%20il%20difetto%20dei%20bordi%20arrotondati%20su%20un%27immagine&amp;bodytext=A%20volte%20basta%20spostare%20un%20elemento%2C%20cambiando%20punto%20di%20vista%2C%20per%20risolvere%20un%20problema%20apparentemente%20insuperabile.%20Quando%20poi%20si%20ha%20a%20che%20fare%20con%20compatibilit%C3%A0%20tra%20i%20browser%20e%20CSS%2C%20inventarsi%20soluzioni%20%22spettacolari%22%20%28acrobazie%20direi%29%20%C3%A8%20all%27ordi" title="Digg"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F21%2Ffirefox-3-5-7-come-risolvere-il-difetto-dei-bordi-arrotondati-su-unimmagine%2F&amp;title=FireFox%203.5.7%3A%20come%20risolvere%20il%20difetto%20dei%20bordi%20arrotondati%20su%20un%27immagine&amp;notes=A%20volte%20basta%20spostare%20un%20elemento%2C%20cambiando%20punto%20di%20vista%2C%20per%20risolvere%20un%20problema%20apparentemente%20insuperabile.%20Quando%20poi%20si%20ha%20a%20che%20fare%20con%20compatibilit%C3%A0%20tra%20i%20browser%20e%20CSS%2C%20inventarsi%20soluzioni%20%22spettacolari%22%20%28acrobazie%20direi%29%20%C3%A8%20all%27ordi" title="del.icio.us"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F21%2Ffirefox-3-5-7-come-risolvere-il-difetto-dei-bordi-arrotondati-su-unimmagine%2F" title="Technorati"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F21%2Ffirefox-3-5-7-come-risolvere-il-difetto-dei-bordi-arrotondati-su-unimmagine%2F&amp;t=FireFox%203.5.7%3A%20come%20risolvere%20il%20difetto%20dei%20bordi%20arrotondati%20su%20un%27immagine" title="Facebook"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F21%2Ffirefox-3-5-7-come-risolvere-il-difetto-dei-bordi-arrotondati-su-unimmagine%2F&amp;title=FireFox%203.5.7%3A%20come%20risolvere%20il%20difetto%20dei%20bordi%20arrotondati%20su%20un%27immagine&amp;annotation=A%20volte%20basta%20spostare%20un%20elemento%2C%20cambiando%20punto%20di%20vista%2C%20per%20risolvere%20un%20problema%20apparentemente%20insuperabile.%20Quando%20poi%20si%20ha%20a%20che%20fare%20con%20compatibilit%C3%A0%20tra%20i%20browser%20e%20CSS%2C%20inventarsi%20soluzioni%20%22spettacolari%22%20%28acrobazie%20direi%29%20%C3%A8%20all%27ordi" title="Google Bookmarks"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=FireFox%203.5.7%3A%20come%20risolvere%20il%20difetto%20dei%20bordi%20arrotondati%20su%20un%27immagine%20-%20http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F21%2Ffirefox-3-5-7-come-risolvere-il-difetto-dei-bordi-arrotondati-su-unimmagine%2F" title="Twitter"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://barrapunto.com/submit.pl?subj=FireFox%203.5.7%3A%20come%20risolvere%20il%20difetto%20dei%20bordi%20arrotondati%20su%20un%27immagine&amp;story=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F21%2Ffirefox-3-5-7-come-risolvere-il-difetto-dei-bordi-arrotondati-su-unimmagine%2F" title="BarraPunto"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://current.com/clipper.htm?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F21%2Ffirefox-3-5-7-come-risolvere-il-difetto-dei-bordi-arrotondati-su-unimmagine%2F&amp;title=FireFox%203.5.7%3A%20come%20risolvere%20il%20difetto%20dei%20bordi%20arrotondati%20su%20un%27immagine" title="Current"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/current.png" title="Current" alt="Current" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=FireFox%203.5.7%3A%20come%20risolvere%20il%20difetto%20dei%20bordi%20arrotondati%20su%20un%27immagine&amp;body=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F21%2Ffirefox-3-5-7-come-risolvere-il-difetto-dei-bordi-arrotondati-su-unimmagine%2F" title="email"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=FireFox%203.5.7%3A%20come%20risolvere%20il%20difetto%20dei%20bordi%20arrotondati%20su%20un%27immagine&amp;link=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F21%2Ffirefox-3-5-7-come-risolvere-il-difetto-dei-bordi-arrotondati-su-unimmagine%2F" title="FriendFeed"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://laaik.it/NewStoryCompact.aspx?uri=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F21%2Ffirefox-3-5-7-come-risolvere-il-difetto-dei-bordi-arrotondati-su-unimmagine%2F&amp;headline=FireFox%203.5.7%3A%20come%20risolvere%20il%20difetto%20dei%20bordi%20arrotondati%20su%20un%27immagine&amp;cat=5e082fcc-8a3b-47e2-acec-fdf64ff19d12" title="laaik.it"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/laaikit.png" title="laaik.it" alt="laaik.it" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F21%2Ffirefox-3-5-7-come-risolvere-il-difetto-dei-bordi-arrotondati-su-unimmagine%2F&amp;title=FireFox%203.5.7%3A%20come%20risolvere%20il%20difetto%20dei%20bordi%20arrotondati%20su%20un%27immagine&amp;source=Undolog.com+Research+%26amp%3B+Development++Blog&amp;summary=A%20volte%20basta%20spostare%20un%20elemento%2C%20cambiando%20punto%20di%20vista%2C%20per%20risolvere%20un%20problema%20apparentemente%20insuperabile.%20Quando%20poi%20si%20ha%20a%20che%20fare%20con%20compatibilit%C3%A0%20tra%20i%20browser%20e%20CSS%2C%20inventarsi%20soluzioni%20%22spettacolari%22%20%28acrobazie%20direi%29%20%C3%A8%20all%27ordi" title="LinkedIn"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F21%2Ffirefox-3-5-7-come-risolvere-il-difetto-dei-bordi-arrotondati-su-unimmagine%2F&amp;title=FireFox%203.5.7%3A%20come%20risolvere%20il%20difetto%20dei%20bordi%20arrotondati%20su%20un%27immagine" title="Live"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F21%2Ffirefox-3-5-7-come-risolvere-il-difetto-dei-bordi-arrotondati-su-unimmagine%2F&amp;t=FireFox%203.5.7%3A%20come%20risolvere%20il%20difetto%20dei%20bordi%20arrotondati%20su%20un%27immagine" title="MySpace"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=FireFox%203.5.7%3A%20come%20risolvere%20il%20difetto%20dei%20bordi%20arrotondati%20su%20un%27immagine&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F21%2Ffirefox-3-5-7-come-risolvere-il-difetto-dei-bordi-arrotondati-su-unimmagine%2F" title="Netvibes"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F21%2Ffirefox-3-5-7-come-risolvere-il-difetto-dei-bordi-arrotondati-su-unimmagine%2F&amp;partner=sociable" title="Print"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.undolog.com/feed/" title="RSS"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://segnalo.alice.it/post.html.php?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F21%2Ffirefox-3-5-7-come-risolvere-il-difetto-dei-bordi-arrotondati-su-unimmagine%2F&amp;title=FireFox%203.5.7%3A%20come%20risolvere%20il%20difetto%20dei%20bordi%20arrotondati%20su%20un%27immagine" title="Segnalo"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/segnalo.png" title="Segnalo" alt="Segnalo" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F21%2Ffirefox-3-5-7-come-risolvere-il-difetto-dei-bordi-arrotondati-su-unimmagine%2F&amp;title=FireFox%203.5.7%3A%20come%20risolvere%20il%20difetto%20dei%20bordi%20arrotondati%20su%20un%27immagine" title="StumbleUpon"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.wikio.it/vote?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F21%2Ffirefox-3-5-7-come-risolvere-il-difetto-dei-bordi-arrotondati-su-unimmagine%2F" title="Wikio IT"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/wikio.png" title="Wikio IT" alt="Wikio IT" class="sociable-hovers" /></a>


<br/><br/>
	Tags: <a href="http://www.undolog.com/tag/moz-border-radius/" title="-moz-border-radius" rel="tag">-moz-border-radius</a>, <a href="http://www.undolog.com/tag/webkit-border-radius/" title="-webkit-border-radius" rel="tag">-webkit-border-radius</a>, <a href="http://www.undolog.com/tag/border-radius/" title="border-radius" rel="tag">border-radius</a>, <a href="http://www.undolog.com/tag/browser/" title="browser" rel="tag">browser</a>, <a href="http://www.undolog.com/tag/chrome/" title="Chrome" rel="tag">Chrome</a>, <a href="http://www.undolog.com/tag/compatibilita/" title="Compatibilità" rel="tag">Compatibilità</a>, <a href="http://www.undolog.com/category/sviluppo/internet/css/" title="CSS" rel="tag">CSS</a>, <a href="http://www.undolog.com/tag/css/" title="CSS" rel="tag">CSS</a>, <a href="http://www.undolog.com/tag/firefox/" title="firefox" rel="tag">firefox</a>, <a href="http://www.undolog.com/tag/google/" title="google" rel="tag">google</a>, <a href="http://www.undolog.com/tag/img/" title="IMG" rel="tag">IMG</a>, <a href="http://www.undolog.com/tag/immagini/" title="Immagini" rel="tag">Immagini</a>, <a href="http://www.undolog.com/category/sviluppo/internet/" title="Internet" rel="tag">Internet</a>, <a href="http://www.undolog.com/tag/mozilla/" title="Mozilla" rel="tag">Mozilla</a>, <a href="http://www.undolog.com/tag/safari/" title="Safari" rel="tag">Safari</a>, <a href="http://www.undolog.com/tag/snipp/" title="Snipp" rel="tag">Snipp</a>, <a href="http://www.undolog.com/category/sviluppo/" title="Sviluppo" rel="tag">Sviluppo</a>, <a href="http://www.undolog.com/tag/web/" title="Web" rel="tag">Web</a>, <a href="http://www.undolog.com/tag/webkit/" title="WebKit" rel="tag">WebKit</a><br />

	<h4>Post correlati</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.undolog.com/2008/10/30/jquery-bordi-rotondi-sulle-immagini-per-sovrapposizione/" title="jQuery: bordi rotondi sulle immagini per sovrapposizione (30 ottobre, 2008)">jQuery: bordi rotondi sulle immagini per sovrapposizione</a> (1)</li>
	<li><a href="http://www.undolog.com/2007/03/12/web20-gran-paradiso-firefox-30-e-apollo/" title="Web2.0: Gran Paradiso-Firefox 3.0 e Apollo (12 marzo, 2007)">Web2.0: Gran Paradiso-Firefox 3.0 e Apollo</a> (2)</li>
	<li><a href="http://www.undolog.com/2009/02/05/very-short-trick-disabilitare-il-ridimensionamento-di-una-textarea-su-safari/" title="Very short trick: disabilitare il ridimensionamento di una textarea su Safari (5 febbraio, 2009)">Very short trick: disabilitare il ridimensionamento di una textarea su Safari</a> (7)</li>
	<li><a href="http://www.undolog.com/2008/10/16/css3-qualcuno-ha-visto-internet-explorer/" title="CSS3: qualcuno ha visto Internet Explorer? (16 ottobre, 2008)">CSS3: qualcuno ha visto Internet Explorer?</a> (5)</li>
	<li><a href="http://www.undolog.com/2008/10/28/creare-applicazioni-desktop-con-google-chrome-e-firefox/" title="Creare applicazioni Desktop con Google Chrome e FireFox? (28 ottobre, 2008)">Creare applicazioni Desktop con Google Chrome e FireFox?</a> (1)</li>
</ul>

<img src="http://feeds.feedburner.com/~r/undolog/~4/rv5QhQG6ke4" height="1" width="1"/>]]></content:encoded><description>A volte basta spostare un elemento, cambiando punto di vista, per risolvere un problema apparentemente insuperabile. Quando poi si ha a che fare con compatibilità tra i browser e CSS, inventarsi soluzioni "spettacolari" (acrobazie direi) è all'ordine del giorno. Quello che vi mostro è un modo semplice per applicare bordi arrotondati a delle immagini utilizzando [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.undolog.com/2010/01/21/firefox-3-5-7-come-risolvere-il-difetto-dei-bordi-arrotondati-su-unimmagine/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">1</slash:comments><feedburner:origLink>http://www.undolog.com/2010/01/21/firefox-3-5-7-come-risolvere-il-difetto-dei-bordi-arrotondati-su-unimmagine/</feedburner:origLink></item><item><title>10 utili snippet per Apple iPhone</title><link>http://feedproxy.google.com/~r/undolog/~3/HEQX4BHg0_o/</link><category>Mobile</category><category>Objective-C</category><category>Sviluppo</category><category>iPhone</category><category>Apple</category><category>Snippets</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Giovambattista Fazioli</dc:creator><pubDate>Thu, 07 Jan 2010 14:53:28 PST</pubDate><guid isPermaLink="false">http://www.undolog.com/?p=2739</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/iyszHSEBdquvXya6_ymV1jDAZM8/0/da"><img src="http://feedads.g.doubleclick.net/~a/iyszHSEBdquvXya6_ymV1jDAZM8/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/iyszHSEBdquvXya6_ymV1jDAZM8/1/da"><img src="http://feedads.g.doubleclick.net/~a/iyszHSEBdquvXya6_ymV1jDAZM8/1/di" border="0" ismap="true"></img></a></p><h4>Eseguire un metodo dopo n secondi</h4>
<p>Tutta la famiglia <a target="_blank" href="http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/Reference/Reference.html#//apple_ref/occ/instm/NSObject/performSelector:withObject:afterDelay:"><code>performSelector</code></a> è davvero interessante e può essere utile in una moltitudine di casi. La sua applicazione più semplice e comune è la seguente:</p>
<div class="igBar"><span id="lobjc-39"><a href="#" onclick="javascript:showCodeTxt('objc-39'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-39">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><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>3<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">//</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>myMethod <span style="color: #002200;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Hello World!&quot;</span><span style="color: #002200;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#125;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Tuttavia considerate che il "timer" non è preciso. Questa procedura, quindi, va usata quando non è richiesta una "notevole" precisione temporale.</p>
<h4>Recuperare la versione dell'applicazione</h4>
<div class="igBar"><span id="lobjc-40"><a href="#" onclick="javascript:showCodeTxt('objc-40'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-40">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>version <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/"><span style="color: #400080;">NSBundle</span></a> mainBundle<span style="color: #002200;">&#93;</span> infoDictionary<span style="color: #002200;">&#93;</span> objectForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;CFBundleVersion&quot;</span><span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;versione = %@&quot;</span>, version<span style="color: #002200;">&#41;</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h4>YES, <span style="text-transform:lowercase">true</span> o TRUE?</h4>
<p>Andando a spulciare nel Kernel Apple iPhone è possibile renderci conto che <code>YES</code>, <code>true</code> e <code>TRUE</code> sono in pratica la stessa edentica cosa:</p>
<div class="igBar"><span id="lobjc-41"><a href="#" onclick="javascript:showCodeTxt('objc-41'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-41">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// definizione di YES</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#define YES (BOOL)1</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#define NO &nbsp;(BOOL)0</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// definizione di true</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#define true &nbsp;1</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#define false 0</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// definizione di TRUE</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#if !defined(TRUE)</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #6e371a;">#define TRUE 1</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#endif</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#if !defined(FALSE)</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #6e371a;">#define FALSE 0</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#endif</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Almeno per adesso...</p>
<h4>Vibrazione</h4>
<div class="igBar"><span id="lobjc-42"><a href="#" onclick="javascript:showCodeTxt('objc-42'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-42">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#import &lt;AudioToolbox/AudioToolbox.h&gt;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">//</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">AudioServicesPlaySystemSound <span style="color: #002200;">&#40;</span>kSystemSoundID_Vibrate<span style="color: #002200;">&#41;</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h4>Puntatore CGImageRef a partire da un UIImage</h4>
<div class="igBar"><span id="lobjc-43"><a href="#" onclick="javascript:showCodeTxt('objc-43'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-43">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">UIImage <span style="color: #002200;">*</span>heart <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;LittleHeart.png&quot;</span><span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">CGImageRef image <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>heart CGImage<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// L'immagine adesso può essere &quot;rasterizzata&quot; su un CGContextRef</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">CGContextDrawImage<span style="color: #002200;">&#40;</span>c, <span style="color: #002200;">&#40;</span>CGRect<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#123;</span>0, 0, 100, 100<span style="color: #002200;">&#125;</span>, image<span style="color: #002200;">&#41;</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h4>Animazioni</h4>
<div class="igBar"><span id="lobjc-44"><a href="#" onclick="javascript:showCodeTxt('objc-44'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-44">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span>UIView beginAnimations<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> context<span style="color: #002200;">:</span><span style="color: #a61390;">NULL</span><span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span>UIView setAnimationDuration<span style="color: #002200;">:</span>1.5<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span>UIView setAnimationCurve<span style="color: #002200;">:</span>UIViewAnimationCurveEaseInOut<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// ...</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span>UIView commitAnimations<span style="color: #002200;">&#93;</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h4>NSLog</h4>
<div class="igBar"><span id="lobjc-45"><a href="#" onclick="javascript:showCodeTxt('objc-45'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-45">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;NSString object %@ &quot;</span>, myString<span style="color: #002200;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Float: %f &quot;</span>, myFloat<span style="color: #002200;">&#41;</span>; </div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Integer: %i &quot;</span>, myInt<span style="color: #002200;">&#41;</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h4>Convertitore da RGB a UIColor</h4>
<div class="igBar"><span id="lobjc-46"><a href="#" onclick="javascript:showCodeTxt('objc-46'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-46">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#define RGBA(r,g,b,a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]</span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h4>Passare parametri ad un NSTimer</h4>
<p>Sfruttando il parametro <code>userInfo</code> è possibile inviare un puntatore ad un nostro oggetto al metodo richiamato da timer.</p>
<div class="igBar"><span id="lobjc-47"><a href="#" onclick="javascript:showCodeTxt('objc-47'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-47">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/"><span style="color: #400080;">NSTimer</span></a> scheduledTimerWithTimeInterval<span style="color: #002200;">:</span>1 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>timerMethod<span style="color: #002200;">&#41;</span> userInfo<span style="color: #002200;">:</span>objectPointer repeats<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// ...</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>timerMethod<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/"><span style="color: #400080;">NSTimer</span></a><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>timer <span style="color: #002200;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// Recupero il puntatore al mio oggetto</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">objectPointer <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>timer userInfo<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// oppure</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>timer userInfo<span style="color: #002200;">&#93;</span> myMethod<span style="color: #002200;">&#93;</span>; </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #a61390;">int</span> a <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>timer userInfo<span style="color: #002200;">&#93;</span> myProperty<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// che è lo stesso</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #a61390;">int</span> a <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>objectPointer myProperty<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#125;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h4>Tempo di esecuzione</h4>
<p>Ecco un semplice modo per calcolare tempi brevi utili per verificare la velocità di esecuzione del codice:</p>
<div class="igBar"><span id="lobjc-48"><a href="#" onclick="javascript:showCodeTxt('objc-48'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-48">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">CFAbsoluteTime initialTime <span style="color: #002200;">=</span> CFAbsoluteTimeGetCurrent<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// ... code</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">CFAbsoluteTime finalTime <span style="color: #002200;">=</span> CFAbsoluteTimeGetCurrent<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>; </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Tempo trascorso %f&quot;</span>, finalTime<span style="color: #002200;">-</span>initialTime<span style="color: #002200;">&#41;</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>




	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F08%2F10-utili-snippet-per-apple-iphone%2F&amp;title=10%20utili%20snippet%20per%20Apple%20iPhone&amp;bodytext=Eseguire%20un%20metodo%20dopo%20n%20secondi%0D%0ATutta%20la%20famiglia%20performSelector%20%C3%A8%20davvero%20interessante%20e%20pu%C3%B2%20essere%20utile%20in%20una%20moltitudine%20di%20casi.%20La%20sua%20applicazione%20pi%C3%B9%20semplice%20e%20comune%20%C3%A8%20la%20seguente%3A%0D%0A%5Bobjc%5D%0D%0A%5Bself%20performSelector%3A%40selector%28myMethod%29" title="Digg"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F08%2F10-utili-snippet-per-apple-iphone%2F&amp;title=10%20utili%20snippet%20per%20Apple%20iPhone&amp;notes=Eseguire%20un%20metodo%20dopo%20n%20secondi%0D%0ATutta%20la%20famiglia%20performSelector%20%C3%A8%20davvero%20interessante%20e%20pu%C3%B2%20essere%20utile%20in%20una%20moltitudine%20di%20casi.%20La%20sua%20applicazione%20pi%C3%B9%20semplice%20e%20comune%20%C3%A8%20la%20seguente%3A%0D%0A%5Bobjc%5D%0D%0A%5Bself%20performSelector%3A%40selector%28myMethod%29" title="del.icio.us"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F08%2F10-utili-snippet-per-apple-iphone%2F" title="Technorati"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F08%2F10-utili-snippet-per-apple-iphone%2F&amp;t=10%20utili%20snippet%20per%20Apple%20iPhone" title="Facebook"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F08%2F10-utili-snippet-per-apple-iphone%2F&amp;title=10%20utili%20snippet%20per%20Apple%20iPhone&amp;annotation=Eseguire%20un%20metodo%20dopo%20n%20secondi%0D%0ATutta%20la%20famiglia%20performSelector%20%C3%A8%20davvero%20interessante%20e%20pu%C3%B2%20essere%20utile%20in%20una%20moltitudine%20di%20casi.%20La%20sua%20applicazione%20pi%C3%B9%20semplice%20e%20comune%20%C3%A8%20la%20seguente%3A%0D%0A%5Bobjc%5D%0D%0A%5Bself%20performSelector%3A%40selector%28myMethod%29" title="Google Bookmarks"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=10%20utili%20snippet%20per%20Apple%20iPhone%20-%20http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F08%2F10-utili-snippet-per-apple-iphone%2F" title="Twitter"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://barrapunto.com/submit.pl?subj=10%20utili%20snippet%20per%20Apple%20iPhone&amp;story=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F08%2F10-utili-snippet-per-apple-iphone%2F" title="BarraPunto"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://current.com/clipper.htm?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F08%2F10-utili-snippet-per-apple-iphone%2F&amp;title=10%20utili%20snippet%20per%20Apple%20iPhone" title="Current"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/current.png" title="Current" alt="Current" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=10%20utili%20snippet%20per%20Apple%20iPhone&amp;body=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F08%2F10-utili-snippet-per-apple-iphone%2F" title="email"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=10%20utili%20snippet%20per%20Apple%20iPhone&amp;link=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F08%2F10-utili-snippet-per-apple-iphone%2F" title="FriendFeed"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://laaik.it/NewStoryCompact.aspx?uri=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F08%2F10-utili-snippet-per-apple-iphone%2F&amp;headline=10%20utili%20snippet%20per%20Apple%20iPhone&amp;cat=5e082fcc-8a3b-47e2-acec-fdf64ff19d12" title="laaik.it"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/laaikit.png" title="laaik.it" alt="laaik.it" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F08%2F10-utili-snippet-per-apple-iphone%2F&amp;title=10%20utili%20snippet%20per%20Apple%20iPhone&amp;source=Undolog.com+Research+%26amp%3B+Development++Blog&amp;summary=Eseguire%20un%20metodo%20dopo%20n%20secondi%0D%0ATutta%20la%20famiglia%20performSelector%20%C3%A8%20davvero%20interessante%20e%20pu%C3%B2%20essere%20utile%20in%20una%20moltitudine%20di%20casi.%20La%20sua%20applicazione%20pi%C3%B9%20semplice%20e%20comune%20%C3%A8%20la%20seguente%3A%0D%0A%5Bobjc%5D%0D%0A%5Bself%20performSelector%3A%40selector%28myMethod%29" title="LinkedIn"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F08%2F10-utili-snippet-per-apple-iphone%2F&amp;title=10%20utili%20snippet%20per%20Apple%20iPhone" title="Live"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F08%2F10-utili-snippet-per-apple-iphone%2F&amp;t=10%20utili%20snippet%20per%20Apple%20iPhone" title="MySpace"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=10%20utili%20snippet%20per%20Apple%20iPhone&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F08%2F10-utili-snippet-per-apple-iphone%2F" title="Netvibes"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F08%2F10-utili-snippet-per-apple-iphone%2F&amp;partner=sociable" title="Print"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.undolog.com/feed/" title="RSS"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://segnalo.alice.it/post.html.php?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F08%2F10-utili-snippet-per-apple-iphone%2F&amp;title=10%20utili%20snippet%20per%20Apple%20iPhone" title="Segnalo"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/segnalo.png" title="Segnalo" alt="Segnalo" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F08%2F10-utili-snippet-per-apple-iphone%2F&amp;title=10%20utili%20snippet%20per%20Apple%20iPhone" title="StumbleUpon"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.wikio.it/vote?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F08%2F10-utili-snippet-per-apple-iphone%2F" title="Wikio IT"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/wikio.png" title="Wikio IT" alt="Wikio IT" class="sociable-hovers" /></a>


<br/><br/>
	Tags: <a href="http://www.undolog.com/tag/apple/" title="Apple" rel="tag">Apple</a>, <a href="http://www.undolog.com/tag/iphone/" title="iPhone" rel="tag">iPhone</a>, <a href="http://www.undolog.com/category/sviluppo/iphone-sviluppo/" title="iPhone" rel="tag">iPhone</a>, <a href="http://www.undolog.com/category/mobile/" title="Mobile" rel="tag">Mobile</a>, <a href="http://www.undolog.com/category/sviluppo/iphone-sviluppo/objective-c-sviluppo/" title="Objective-C" rel="tag">Objective-C</a>, <a href="http://www.undolog.com/tag/snippets/" title="Snippets" rel="tag">Snippets</a>, <a href="http://www.undolog.com/category/sviluppo/" title="Sviluppo" rel="tag">Sviluppo</a><br />

	<h4>Post correlati</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.undolog.com/2009/10/09/very-short-snippet-iphone-numeri-casuali/" title="Very short snippet: iPhone, numeri casuali (9 ottobre, 2009)">Very short snippet: iPhone, numeri casuali</a> (0)</li>
	<li><a href="http://www.undolog.com/2009/07/10/xcode-organizzare-il-codice-con-la-direttiva-pragma-mark/" title="XCode: organizzare il codice con la direttiva #pragma mark (10 luglio, 2009)">XCode: organizzare il codice con la direttiva #pragma mark</a> (0)</li>
	<li><a href="http://www.undolog.com/2009/07/20/xcode-consigli-sul-debugging-preferences/" title="XCode: consigli sul Debugging Preferences (20 luglio, 2009)">XCode: consigli sul Debugging Preferences</a> (0)</li>
	<li><a href="http://www.undolog.com/2009/07/23/xcode-shortcut/" title="Xcode shortcut (23 luglio, 2009)">Xcode shortcut</a> (0)</li>
	<li><a href="http://www.undolog.com/2009/06/16/very-short-trick-fermare-nstimer/" title="Very short trick: fermare NSTimer (16 giugno, 2009)">Very short trick: fermare NSTimer</a> (0)</li>
</ul>

<img src="http://feeds.feedburner.com/~r/undolog/~4/HEQX4BHg0_o" height="1" width="1"/>]]></content:encoded><description>Eseguire un metodo dopo n secondi
Tutta la famiglia performSelector è davvero interessante e può essere utile in una moltitudine di casi. La sua applicazione più semplice e comune è la seguente:
PLAIN TEXT
Objective-C:




&amp;#91;self performSelector:@selector&amp;#40;myMethod&amp;#41; withObject:nil afterDelay:3&amp;#93;;


//


- &amp;#40;void&amp;#41;myMethod &amp;#123;


&amp;#160; &amp;#160; NSLog&amp;#40;@&amp;#34;Hello World!&amp;#34;&amp;#41;;


&amp;#125;






Tuttavia considerate che il "timer" non è preciso. Questa procedura, quindi, va usata quando non è [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.undolog.com/2010/01/08/10-utili-snippet-per-apple-iphone/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://www.undolog.com/2010/01/08/10-utili-snippet-per-apple-iphone/</feedburner:origLink></item><item><title>Commodore 64 Javascript emulator</title><link>http://feedproxy.google.com/~r/undolog/~3/RC1_rxfF4no/</link><category>Eventi &amp; Iniziative</category><category>Flash</category><category>Internet</category><category>Javascript</category><category>Software</category><category>Sviluppo</category><category>jQuery</category><category>ActionScript-3.0</category><category>Adobe-Flash</category><category>Commodore-64</category><category>emulatori</category><category>Porting</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Giovambattista Fazioli</dc:creator><pubDate>Tue, 05 Jan 2010 15:18:38 PST</pubDate><guid isPermaLink="false">http://www.undolog.com/?p=2788</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/jbSIV38mQ3HknZSencAtHLH27XI/0/da"><img src="http://feedads.g.doubleclick.net/~a/jbSIV38mQ3HknZSencAtHLH27XI/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/jbSIV38mQ3HknZSencAtHLH27XI/1/da"><img src="http://feedads.g.doubleclick.net/~a/jbSIV38mQ3HknZSencAtHLH27XI/1/di" border="0" ismap="true"></img></a></p><p>Un po' di tempo fa avevo <a href="http://www.undolog.com/2007/03/02/commodore-64-web-emulator/">segnalato</a> la versione di un emulatore <strong>Commodore 64</strong> scritto in <strong>Adobe Actionscript 3.0</strong>, oggi in una <a target="_blank" href="http://codeazur.com.br/stuff/fc64_final/">nuova versione</a>:</p>
<p class="center"><a target="_blank" class="notarget" href="http://codeazur.com.br/stuff/fc64_final/"><img src="http://www.undolog.com/wp-content/uploads/2010/01/Schermata-2010-01-06-a-00.00.101.png" alt="Commodore 64 Emulator in Adobe Flash" title="Commodore 64 Emulator in Adobe Flash"  /></a></p>
<p>Adesso è possibile apprezzare il porting della versione Adobe Flash in <strong><a target="_blank" href="http://www.kingsquare.nl/jsc64">Javascript</a></strong>:<br />
<a target="_blank" class="notarget" href="http://www.kingsquare.nl/jsc64"><img src="http://www.undolog.com/wp-content/uploads/2010/01/Schermata-2010-01-05-a-23.59.531.png" alt="Commodore 64 Emulator in Javascript" title="Commodore 64 Emulator in Javascript" /></a><br />
Sicuramente più lenta della sua controparte in Flash, questa versione in javascript si avvale di <a target="_blank" href="http://jquery.com">jQuery</a> e, di fatto, ne diventa un'estensione per non dire Plugin <img src='http://www.undolog.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  (assai riduttivo). Buon divertimento...</p>




	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F06%2Fcommodore-64-javascript-emulator%2F&amp;title=Commodore%2064%20Javascript%20emulator&amp;bodytext=Un%20po%27%20di%20tempo%20fa%20avevo%20segnalato%20la%20versione%20di%20un%20emulatore%20Commodore%2064%20scritto%20in%20Adobe%20Actionscript%203.0%2C%20oggi%20in%20una%20nuova%20versione%3A%0D%0A%0D%0A%0D%0AAdesso%20%C3%A8%20possibile%20apprezzare%20il%20porting%20della%20versione%20Adobe%20Flash%20in%20Javascript%3A%0D%0A%0D%0ASicuramente%20pi%C3%B9%20le" title="Digg"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F06%2Fcommodore-64-javascript-emulator%2F&amp;title=Commodore%2064%20Javascript%20emulator&amp;notes=Un%20po%27%20di%20tempo%20fa%20avevo%20segnalato%20la%20versione%20di%20un%20emulatore%20Commodore%2064%20scritto%20in%20Adobe%20Actionscript%203.0%2C%20oggi%20in%20una%20nuova%20versione%3A%0D%0A%0D%0A%0D%0AAdesso%20%C3%A8%20possibile%20apprezzare%20il%20porting%20della%20versione%20Adobe%20Flash%20in%20Javascript%3A%0D%0A%0D%0ASicuramente%20pi%C3%B9%20le" title="del.icio.us"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F06%2Fcommodore-64-javascript-emulator%2F" title="Technorati"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F06%2Fcommodore-64-javascript-emulator%2F&amp;t=Commodore%2064%20Javascript%20emulator" title="Facebook"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F06%2Fcommodore-64-javascript-emulator%2F&amp;title=Commodore%2064%20Javascript%20emulator&amp;annotation=Un%20po%27%20di%20tempo%20fa%20avevo%20segnalato%20la%20versione%20di%20un%20emulatore%20Commodore%2064%20scritto%20in%20Adobe%20Actionscript%203.0%2C%20oggi%20in%20una%20nuova%20versione%3A%0D%0A%0D%0A%0D%0AAdesso%20%C3%A8%20possibile%20apprezzare%20il%20porting%20della%20versione%20Adobe%20Flash%20in%20Javascript%3A%0D%0A%0D%0ASicuramente%20pi%C3%B9%20le" title="Google Bookmarks"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Commodore%2064%20Javascript%20emulator%20-%20http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F06%2Fcommodore-64-javascript-emulator%2F" title="Twitter"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://barrapunto.com/submit.pl?subj=Commodore%2064%20Javascript%20emulator&amp;story=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F06%2Fcommodore-64-javascript-emulator%2F" title="BarraPunto"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://current.com/clipper.htm?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F06%2Fcommodore-64-javascript-emulator%2F&amp;title=Commodore%2064%20Javascript%20emulator" title="Current"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/current.png" title="Current" alt="Current" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=Commodore%2064%20Javascript%20emulator&amp;body=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F06%2Fcommodore-64-javascript-emulator%2F" title="email"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Commodore%2064%20Javascript%20emulator&amp;link=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F06%2Fcommodore-64-javascript-emulator%2F" title="FriendFeed"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://laaik.it/NewStoryCompact.aspx?uri=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F06%2Fcommodore-64-javascript-emulator%2F&amp;headline=Commodore%2064%20Javascript%20emulator&amp;cat=5e082fcc-8a3b-47e2-acec-fdf64ff19d12" title="laaik.it"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/laaikit.png" title="laaik.it" alt="laaik.it" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F06%2Fcommodore-64-javascript-emulator%2F&amp;title=Commodore%2064%20Javascript%20emulator&amp;source=Undolog.com+Research+%26amp%3B+Development++Blog&amp;summary=Un%20po%27%20di%20tempo%20fa%20avevo%20segnalato%20la%20versione%20di%20un%20emulatore%20Commodore%2064%20scritto%20in%20Adobe%20Actionscript%203.0%2C%20oggi%20in%20una%20nuova%20versione%3A%0D%0A%0D%0A%0D%0AAdesso%20%C3%A8%20possibile%20apprezzare%20il%20porting%20della%20versione%20Adobe%20Flash%20in%20Javascript%3A%0D%0A%0D%0ASicuramente%20pi%C3%B9%20le" title="LinkedIn"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F06%2Fcommodore-64-javascript-emulator%2F&amp;title=Commodore%2064%20Javascript%20emulator" title="Live"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F06%2Fcommodore-64-javascript-emulator%2F&amp;t=Commodore%2064%20Javascript%20emulator" title="MySpace"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Commodore%2064%20Javascript%20emulator&amp;url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F06%2Fcommodore-64-javascript-emulator%2F" title="Netvibes"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F06%2Fcommodore-64-javascript-emulator%2F&amp;partner=sociable" title="Print"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.undolog.com/feed/" title="RSS"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://segnalo.alice.it/post.html.php?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F06%2Fcommodore-64-javascript-emulator%2F&amp;title=Commodore%2064%20Javascript%20emulator" title="Segnalo"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/segnalo.png" title="Segnalo" alt="Segnalo" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F06%2Fcommodore-64-javascript-emulator%2F&amp;title=Commodore%2064%20Javascript%20emulator" title="StumbleUpon"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.wikio.it/vote?url=http%3A%2F%2Fwww.undolog.com%2F2010%2F01%2F06%2Fcommodore-64-javascript-emulator%2F" title="Wikio IT"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/wikio.png" title="Wikio IT" alt="Wikio IT" class="sociable-hovers" /></a>


<br/><br/>
	Tags: <a href="http://www.undolog.com/tag/actionscript-3-0/" title="ActionScript-3.0" rel="tag">ActionScript-3.0</a>, <a href="http://www.undolog.com/tag/adobe-flash/" title="Adobe-Flash" rel="tag">Adobe-Flash</a>, <a href="http://www.undolog.com/tag/commodore-64/" title="Commodore-64" rel="tag">Commodore-64</a>, <a href="http://www.undolog.com/tag/emulatori/" title="emulatori" rel="tag">emulatori</a>, <a href="http://www.undolog.com/category/eventi-iniziative/" title="Eventi &amp; Iniziative" rel="tag">Eventi &amp; Iniziative</a>, <a href="http://www.undolog.com/category/sviluppo/flash/" title="Flash" rel="tag">Flash</a>, <a href="http://www.undolog.com/category/sviluppo/internet/" title="Internet" rel="tag">Internet</a>, <a href="http://www.undolog.com/category/sviluppo/internet/javascript/" title="Javascript" rel="tag">Javascript</a>, <a href="http://www.undolog.com/tag/javascript/" title="Javascript" rel="tag">Javascript</a>, <a href="http://www.undolog.com/category/sviluppo/internet/javascript/jquery-javascript-internet-sviluppo/" title="jQuery" rel="tag">jQuery</a>, <a href="http://www.undolog.com/tag/porting/" title="Porting" rel="tag">Porting</a>, <a href="http://www.undolog.com/category/software/" title="Software" rel="tag">Software</a>, <a href="http://www.undolog.com/category/sviluppo/" title="Sviluppo" rel="tag">Sviluppo</a><br />

	<h4>Post correlati</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.undolog.com/2007/03/14/emulatore-assembler-6502/" title="Emulatore Assembler 6502 (14 marzo, 2007)">Emulatore Assembler 6502</a> (3)</li>
	<li><a href="http://www.undolog.com/2007/03/02/commodore-64-web-emulator/" title="Commodore 64 Web Emulator (2 marzo, 2007)">Commodore 64 Web Emulator</a> (4)</li>
	<li><a href="http://www.undolog.com/2007/03/05/codice-per-commodore-64/" title="Codice per Commodore 64 (5 marzo, 2007)">Codice per Commodore 64</a> (5)</li>
	<li><a href="http://www.undolog.com/2007/03/12/web20-gran-paradiso-firefox-30-e-apollo/" title="Web2.0: Gran Paradiso-Firefox 3.0 e Apollo (12 marzo, 2007)">Web2.0: Gran Paradiso-Firefox 3.0 e Apollo</a> (2)</li>
	<li><a href="http://www.undolog.com/2007/04/10/unobtrusive-flash-objects/" title="Unobtrusive Flash Objects (10 aprile, 2007)">Unobtrusive Flash Objects</a> (1)</li>
</ul>

<img src="http://feeds.feedburner.com/~r/undolog/~4/RC1_rxfF4no" height="1" width="1"/>]]></content:encoded><description>Un po' di tempo fa avevo segnalato la versione di un emulatore Commodore 64 scritto in Adobe Actionscript 3.0, oggi in una nuova versione:

Adesso è possibile apprezzare il porting della versione Adobe Flash in Javascript:

Sicuramente più lenta della sua controparte in Flash, questa versione in javascript si avvale di jQuery e, di fatto, ne diventa [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.undolog.com/2010/01/06/commodore-64-javascript-emulator/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://www.undolog.com/2010/01/06/commodore-64-javascript-emulator/</feedburner:origLink></item><item><title>Objective-C: esporre proprietà in una classe</title><link>http://feedproxy.google.com/~r/undolog/~3/zbXMkMdAgUo/</link><category>Mobile</category><category>Objective-C</category><category>Sviluppo</category><category>iPhone</category><category>@synthesize</category><category>Apple iPhone</category><category>classe</category><category>getter</category><category>Object-Oriented</category><category>property</category><category>Release</category><category>retain</category><category>setter</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Giovambattista Fazioli</dc:creator><pubDate>Mon, 14 Dec 2009 08:30:11 PST</pubDate><guid isPermaLink="false">http://www.undolog.com/?p=2773</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/mkv7qnsxK43sOzsZpWd0-6N4Qn8/0/da"><img src="http://feedads.g.doubleclick.net/~a/mkv7qnsxK43sOzsZpWd0-6N4Qn8/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/mkv7qnsxK43sOzsZpWd0-6N4Qn8/1/da"><img src="http://feedads.g.doubleclick.net/~a/mkv7qnsxK43sOzsZpWd0-6N4Qn8/1/di" border="0" ismap="true"></img></a></p><p>Vorrei mostrare e discutere alcuni esempi sul come aggiungere e manipolare proprietà in una Classe Objective-C. Un esempio classico, per l'appunto, è il seguente; nella definizione della nostra interfaccia di classe definiamo due proprietà <code>nome</code> e <code>cognome</code>:</p>
<div class="igBar"><span id="lobjc-59"><a href="#" onclick="javascript:showCodeTxt('objc-59'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-59">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// MyClass.h</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#import &lt;Foundation/Foundation.h&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #a61390;">@interface</span> MyClass <span style="color: #002200;">:</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/"><span style="color: #400080;">NSObject</span></a> <span style="color: #002200;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>nome;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>cognome;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#125;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>retain<span style="color: #002200;">&#41;</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>nome;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>retain<span style="color: #002200;">&#41;</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>cognome;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #a61390;">@end</span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Nel file di implementazione inseriamo la dichiarazione <code>@synthesize</code> in modo tale che Xcode produca per noi i metodi <code>getter</code> e <code>setter</code> usati rispettivamente per leggere ed impostare le nostre due proprietà:</p>
<div class="igBar"><span id="lobjc-60"><a href="#" onclick="javascript:showCodeTxt('objc-60'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-60">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// MyClass.m</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#import &quot;MyClass.h&quot;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #a61390;">@implementation</span> MyClass</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #a61390;">@synthesize</span> nome, cognome;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #a61390;">@end</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Quando andremo ad utilizzare la nostra classe <code>MyClass</code>, cioè quando istanziaremo un oggetto di tipo <code>MyClass</code>, possiamo scrive:</p>
<div class="igBar"><span id="lobjc-61"><a href="#" onclick="javascript:showCodeTxt('objc-61'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-61">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// qualsiasi altra classe, come AppDelegate</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// nel file .h</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#import &lt;UIKit/UIKit.h&gt;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#import &quot;MyClass.h&quot;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #a61390;">@class</span> TestViewController;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #a61390;">@interface</span> TesAppDelegate <span style="color: #002200;">:</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/"><span style="color: #400080;">NSObject</span></a> &lt;UIApplicationDelegate&gt; <span style="color: #002200;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; UIWindow <span style="color: #002200;">*</span>window;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; TestViewController <span style="color: #002200;">*</span>viewController;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; MyClass <span style="color: #002200;">*</span>miaClasse;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#125;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// nel file .m</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">miaClasse <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>MyClass alloc<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">miaClasse.nome <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Giovambattista&quot;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;miaClasse.nome = %@&quot;</span>, miaClasse.nome<span style="color: #002200;">&#41;</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p>
Oppure, che è equivalente:</p>
<div class="igBar"><span id="lobjc-62"><a href="#" onclick="javascript:showCodeTxt('objc-62'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-62">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// sempre nel file .m</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span>miaClasse setNome<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Undolog&quot;</span><span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;miaClasse.nome = %@&quot;</span>,<span style="color: #002200;">&#91;</span>miaClasse nome<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p>
Fin qui tutto bene. Tuttavia potrebbe fuorviare l'equivalenza delle "variabli" interne (ivar) con il nome della proprietà vera e propria. Per capire la differenza, ripropongo lo stesso esempio facendo a meno, questa volta, di <code>@synthesize</code>. Ora, quindi, dovremmo occuparci noi di scrivere i metodi <code>getter</code> e <code>setter</code>. Per sottolineare ulteriormente le differenze, rinominerò le variabili interne inserendo un underscore davanti al nome. Ma vediamo il codice:</p>
<div class="igBar"><span id="lobjc-63"><a href="#" onclick="javascript:showCodeTxt('objc-63'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-63">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#import &lt;Foundation/Foundation.h&gt;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #a61390;">@interface</span> MyClass <span style="color: #002200;">:</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/"><span style="color: #400080;">NSObject</span></a> <span style="color: #002200;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>_nome;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>_cognome;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> nome; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// get</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> cognome; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #11740a; font-style: italic;">// get</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> setNome<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>stringaIngresso; &nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// set</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> setCognome<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>stringaIngresso; &nbsp;<span style="color: #11740a; font-style: italic;">// set</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #a61390;">@end</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
A differenza dell'esempio precedente i puntatori alla variabili interne (incapsultate) sono diventati <code>_nome</code> e <code>_cognome</code>. Inoltre troviamo quattro definizioni di metodi che rappresentano le nostre <code>get</code> e <code>set</code>. <code>@property</code> è scomparso, in quanto non serve più.<br />
Vediamo il file di implementazione <code>MyClass.m</code>:</p>
<div class="igBar"><span id="lobjc-64"><a href="#" onclick="javascript:showCodeTxt('objc-64'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-64">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#import &quot;MyClass.h&quot;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #a61390;">@implementation</span> MyClass</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// get per &quot;nome&quot;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> nome <span style="color: #002200;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #a61390;">return</span> _nome;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// set per &quot;nome&quot;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> setNome<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>stringaIngresso <span style="color: #002200;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; _nome <span style="color: #002200;">=</span> stringaIngresso;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// get per &quot;cognome&quot;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> cognome <span style="color: #002200;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #a61390;">return</span> _cognome;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#125;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// set per &quot;cognome&quot;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> setCognome<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>stringaIngresso <span style="color: #002200;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; _cognome <span style="color: #002200;">=</span> stringaIngresso;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#125;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #a61390;">@end</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Una classe così scritta potrà essere utilizzata esattamente come la precedente, cioè:</p>
<div class="igBar"><span id="lobjc-65"><a href="#" onclick="javascript:showCodeTxt('objc-65'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-65">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">miaClasse <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>MyClass alloc<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">miaClasse.nome <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Giovambattista&quot;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;miaClasse.nome = %@&quot;</span>, miaClasse.nome<span style="color: #002200;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// Oppure, che è equivalente:</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span>miaClasse setNome<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Undolog&quot;</span><span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;miaClasse.nome = %@&quot;</span>,<span style="color: #002200;">&#91;</span>miaClasse nome<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p>
A livello didattico l'abbandono di <code>@synthesize</code> ci ha costretto a scrivere "da soli" i metodi di <code>get</code> e <code>set</code>, evidenziando - anche con l'aggiunta dell'underscore - le differenze tra il nome della proprietà e la sua ivar interna <code>_nome</code>.<br />
A livello funzionale l'uso dei metodi personali <code>get</code> e <code>set</code> permette un reale controllo del dato prima della sua impostazione (o prima della sua lettura) e quindi un reale incapsulamento per proteggere la variabile interna.<br />
Ad esempio sarebbe possibile impedire il passaggio di stringhe vuote alla proprietà <code>nome</code>:</p>
<div class="igBar"><span id="lobjc-66"><a href="#" onclick="javascript:showCodeTxt('objc-66'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-66">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> setNome<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>stringaIngresso <span style="color: #002200;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span> stringaIngresso <span style="color: #002200;">==</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span> <span style="color: #002200;">&#41;</span> stringaIngresso <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;senza nome&quot;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; _nome <span style="color: #002200;">=</span> stringaIngresso;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#125;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h4>Ulteriore variante</h4>
<p>Se desiderate utilizzare le variabili interne con l'underscore davanti (chi rpoviene da Adobe Actionscript potrebbe essere abituato così) non è necessario abbandonare l'uso della direttiva <code>@synthesize</code>. Xcode permette infatti di "fondere" i metodi sopra indicati:</p>
<div class="igBar"><span id="lobjc-67"><a href="#" onclick="javascript:showCodeTxt('objc-67'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-67">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #a61390;">@synthesize</span> nome <span style="color: #002200;">=</span> _nome;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #a61390;">@synthesize</span> cognome <span style="color: #002200;">=</span> _cognome;</div>
</li>
</ol>
</div>
</div>
</div>
<p>
Così facendo potremmo usare internamente il puntatore a <code>_nome</code>, "sintetizzato" - verso l'esterno - come proprietà <code>nome</code>. Inoltre, se è vero che l'uso di <code>@synthesize</code> produce la generazione automatica dei metodi (messaggi) di <code>getter</code> e <code>setter</code>, è vero anche che lo fa solo se non li trova, quindi se desiderate "implementare" un vostro metodo di <code>getter</code> e/o <code>setter</code> <strong>potete farlo anche se avete usato la direttiva <code>@synthesize</code></strong>.</p>
<h4>Allocazioni di memoria</h4>
<p>Negli esempi di sopra ho omesso alcuni dettagli importanti ai fini di una reale implementazione. Prima di tutto non ho illustrato nessun metodo <code>init()</code>, utile ai fini dell'inizializzazione dell'oggetto e dei sui valori di default. Inoltre, manca l'aggiunta di un metodo <code>dealloc()</code>:</p>
<div class="igBar"><span id="lobjc-68"><a href="#" onclick="javascript:showCodeTxt('objc-68'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-68">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// file MyClass.m</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#import &quot;MyClass.h&quot;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #a61390;">@implementation</span> MyClass</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span> init <span style="color: #002200;">&#123;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span> self <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>super init<span style="color: #002200;">&#93;</span> <span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span> </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; _nome <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Nome preimpostato&quot;</span>; </div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; _cognome <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Cognome preimpostato&quot;</span>; </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #002200;">&#125;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #a61390;">return</span> self; </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#125;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> dealloc <span style="color: #002200;">&#123;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>_nome release<span style="color: #002200;">&#93;</span>; </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>_cognome release<span style="color: #002200;">&#93;</span>; </div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>super dealloc<span style="color: #002200;">&#93;</span>; </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> nome <span style="color: #002200;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #a61390;">return</span> _nome;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> setNome<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>stringaIngresso <span style="color: #002200;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span> stringaIngresso <span style="color: #002200;">==</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span> <span style="color: #002200;">&#41;</span> stringaIngresso <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;senza nome&quot;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; _nome <span style="color: #002200;">=</span> stringaIngresso;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> cognome <span style="color: #002200;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #a61390;">return</span> _cognome;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> setCognome<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>stringaIngresso <span style="color: #002200;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; _cognome <span style="color: #002200;">=</span> stringaIngresso;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#125;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #a61390;">@end</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
In futuro vedremo poi i dettagli sulle proprietà <code>readonly</code>, <code>retain</code>, etc... <img src='http://www.undolog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>




	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F14%2Fobjective-c-esporre-proprieta-in-una-classe%2F&amp;title=Objective-C%3A%20esporre%20propriet%C3%A0%20in%20una%20classe&amp;bodytext=Vorrei%20mostrare%20e%20discutere%20alcuni%20esempi%20sul%20come%20aggiungere%20e%20manipolare%20propriet%C3%A0%20in%20una%20Classe%20Objective-C.%20Un%20esempio%20classico%2C%20per%20l%27appunto%2C%20%C3%A8%20il%20seguente%3B%20nella%20definizione%20della%20nostra%20interfaccia%20di%20classe%20definiamo%20due%20propriet%C3%A0%20nome%20e%20" title="Digg"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F14%2Fobjective-c-esporre-proprieta-in-una-classe%2F&amp;title=Objective-C%3A%20esporre%20propriet%C3%A0%20in%20una%20classe&amp;notes=Vorrei%20mostrare%20e%20discutere%20alcuni%20esempi%20sul%20come%20aggiungere%20e%20manipolare%20propriet%C3%A0%20in%20una%20Classe%20Objective-C.%20Un%20esempio%20classico%2C%20per%20l%27appunto%2C%20%C3%A8%20il%20seguente%3B%20nella%20definizione%20della%20nostra%20interfaccia%20di%20classe%20definiamo%20due%20propriet%C3%A0%20nome%20e%20" title="del.icio.us"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F14%2Fobjective-c-esporre-proprieta-in-una-classe%2F" title="Technorati"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F14%2Fobjective-c-esporre-proprieta-in-una-classe%2F&amp;t=Objective-C%3A%20esporre%20propriet%C3%A0%20in%20una%20classe" title="Facebook"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F14%2Fobjective-c-esporre-proprieta-in-una-classe%2F&amp;title=Objective-C%3A%20esporre%20propriet%C3%A0%20in%20una%20classe&amp;annotation=Vorrei%20mostrare%20e%20discutere%20alcuni%20esempi%20sul%20come%20aggiungere%20e%20manipolare%20propriet%C3%A0%20in%20una%20Classe%20Objective-C.%20Un%20esempio%20classico%2C%20per%20l%27appunto%2C%20%C3%A8%20il%20seguente%3B%20nella%20definizione%20della%20nostra%20interfaccia%20di%20classe%20definiamo%20due%20propriet%C3%A0%20nome%20e%20" title="Google Bookmarks"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Objective-C%3A%20esporre%20propriet%C3%A0%20in%20una%20classe%20-%20http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F14%2Fobjective-c-esporre-proprieta-in-una-classe%2F" title="Twitter"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://barrapunto.com/submit.pl?subj=Objective-C%3A%20esporre%20propriet%C3%A0%20in%20una%20classe&amp;story=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F14%2Fobjective-c-esporre-proprieta-in-una-classe%2F" title="BarraPunto"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://current.com/clipper.htm?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F14%2Fobjective-c-esporre-proprieta-in-una-classe%2F&amp;title=Objective-C%3A%20esporre%20propriet%C3%A0%20in%20una%20classe" title="Current"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/current.png" title="Current" alt="Current" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=Objective-C%3A%20esporre%20propriet%C3%A0%20in%20una%20classe&amp;body=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F14%2Fobjective-c-esporre-proprieta-in-una-classe%2F" title="email"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Objective-C%3A%20esporre%20propriet%C3%A0%20in%20una%20classe&amp;link=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F14%2Fobjective-c-esporre-proprieta-in-una-classe%2F" title="FriendFeed"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://laaik.it/NewStoryCompact.aspx?uri=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F14%2Fobjective-c-esporre-proprieta-in-una-classe%2F&amp;headline=Objective-C%3A%20esporre%20propriet%C3%A0%20in%20una%20classe&amp;cat=5e082fcc-8a3b-47e2-acec-fdf64ff19d12" title="laaik.it"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/laaikit.png" title="laaik.it" alt="laaik.it" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F14%2Fobjective-c-esporre-proprieta-in-una-classe%2F&amp;title=Objective-C%3A%20esporre%20propriet%C3%A0%20in%20una%20classe&amp;source=Undolog.com+Research+%26amp%3B+Development++Blog&amp;summary=Vorrei%20mostrare%20e%20discutere%20alcuni%20esempi%20sul%20come%20aggiungere%20e%20manipolare%20propriet%C3%A0%20in%20una%20Classe%20Objective-C.%20Un%20esempio%20classico%2C%20per%20l%27appunto%2C%20%C3%A8%20il%20seguente%3B%20nella%20definizione%20della%20nostra%20interfaccia%20di%20classe%20definiamo%20due%20propriet%C3%A0%20nome%20e%20" title="LinkedIn"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F14%2Fobjective-c-esporre-proprieta-in-una-classe%2F&amp;title=Objective-C%3A%20esporre%20propriet%C3%A0%20in%20una%20classe" title="Live"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F14%2Fobjective-c-esporre-proprieta-in-una-classe%2F&amp;t=Objective-C%3A%20esporre%20propriet%C3%A0%20in%20una%20classe" title="MySpace"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Objective-C%3A%20esporre%20propriet%C3%A0%20in%20una%20classe&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F14%2Fobjective-c-esporre-proprieta-in-una-classe%2F" title="Netvibes"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F14%2Fobjective-c-esporre-proprieta-in-una-classe%2F&amp;partner=sociable" title="Print"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.undolog.com/feed/" title="RSS"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://segnalo.alice.it/post.html.php?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F14%2Fobjective-c-esporre-proprieta-in-una-classe%2F&amp;title=Objective-C%3A%20esporre%20propriet%C3%A0%20in%20una%20classe" title="Segnalo"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/segnalo.png" title="Segnalo" alt="Segnalo" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F14%2Fobjective-c-esporre-proprieta-in-una-classe%2F&amp;title=Objective-C%3A%20esporre%20propriet%C3%A0%20in%20una%20classe" title="StumbleUpon"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.wikio.it/vote?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F14%2Fobjective-c-esporre-proprieta-in-una-classe%2F" title="Wikio IT"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/wikio.png" title="Wikio IT" alt="Wikio IT" class="sociable-hovers" /></a>


<br/><br/>
	Tags: <a href="http://www.undolog.com/tag/synthesize/" title="@synthesize" rel="tag">@synthesize</a>, <a href="http://www.undolog.com/tag/apple-iphone/" title="Apple iPhone" rel="tag">Apple iPhone</a>, <a href="http://www.undolog.com/tag/classe/" title="classe" rel="tag">classe</a>, <a href="http://www.undolog.com/tag/getter/" title="getter" rel="tag">getter</a>, <a href="http://www.undolog.com/category/sviluppo/iphone-sviluppo/" title="iPhone" rel="tag">iPhone</a>, <a href="http://www.undolog.com/category/mobile/" title="Mobile" rel="tag">Mobile</a>, <a href="http://www.undolog.com/tag/object-oriented/" title="Object-Oriented" rel="tag">Object-Oriented</a>, <a href="http://www.undolog.com/tag/objective-c/" title="Objective-C" rel="tag">Objective-C</a>, <a href="http://www.undolog.com/category/sviluppo/iphone-sviluppo/objective-c-sviluppo/" title="Objective-C" rel="tag">Objective-C</a>, <a href="http://www.undolog.com/tag/property/" title="property" rel="tag">property</a>, <a href="http://www.undolog.com/tag/release/" title="Release" rel="tag">Release</a>, <a href="http://www.undolog.com/tag/retain/" title="retain" rel="tag">retain</a>, <a href="http://www.undolog.com/tag/setter/" title="setter" rel="tag">setter</a>, <a href="http://www.undolog.com/category/sviluppo/" title="Sviluppo" rel="tag">Sviluppo</a><br />

	<h4>Post correlati</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.undolog.com/2007/11/09/aggiungere-propriet-ad-un-movieclip/" title="Aggiungere propriet&agrave; ad un MovieClip (9 novembre, 2007)">Aggiungere propriet&agrave; ad un MovieClip</a> (3)</li>
	<li><a href="http://www.undolog.com/2009/11/21/very-short-snippet-apple-iphone-file-system/" title="Very short snippet: Apple iPhone file system (21 novembre, 2009)">Very short snippet: Apple iPhone file system</a> (0)</li>
	<li><a href="http://www.undolog.com/2009/06/12/da-actionscript-ad-objective-c/" title="Da Actionscript ad Objective-C (12 giugno, 2009)">Da Actionscript ad Objective-C</a> (1)</li>
	<li><a href="http://www.undolog.com/2009/06/26/come-eliminare-nslog-dai-sorgenti-xcode/" title="Come eliminare NSLog() dai sorgenti XCode (26 giugno, 2009)">Come eliminare NSLog() dai sorgenti XCode</a> (0)</li>
	<li><a href="http://www.undolog.com/2008/01/29/classi-oggetti-e-istanze/" title="Classi, Oggetti e Istanze (29 gennaio, 2008)">Classi, Oggetti e Istanze</a> (2)</li>
</ul>

<img src="http://feeds.feedburner.com/~r/undolog/~4/zbXMkMdAgUo" height="1" width="1"/>]]></content:encoded><description>Vorrei mostrare e discutere alcuni esempi sul come aggiungere e manipolare proprietà in una Classe Objective-C. Un esempio classico, per l'appunto, è il seguente; nella definizione della nostra interfaccia di classe definiamo due proprietà nome e cognome:
PLAIN TEXT
Objective-C:




// MyClass.h


#import &amp;#60;Foundation/Foundation.h&amp;#62;


&amp;#160;


@interface MyClass : NSObject &amp;#123;


&amp;#160; &amp;#160; NSString *nome;


&amp;#160; &amp;#160; NSString *cognome;


&amp;#125;


&amp;#160;


@property &amp;#40;retain&amp;#41; NSString *nome;


@property &amp;#40;retain&amp;#41; NSString [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.undolog.com/2009/12/14/objective-c-esporre-proprieta-in-una-classe/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://www.undolog.com/2009/12/14/objective-c-esporre-proprieta-in-una-classe/</feedburner:origLink></item><item><title>Browser o Mobile Browser?</title><link>http://feedproxy.google.com/~r/undolog/~3/7Y_qhMIoyYE/</link><category>Internet</category><category>Mobile</category><category>PHP</category><category>Sviluppo</category><category>WordPress</category><category>iPhone</category><category>$_SERVER['HTTP_USER_AGENT']</category><category>Apple iPhone</category><category>browser</category><category>Device</category><category>iPod</category><category>Layout</category><category>Plugin</category><category>Tema</category><category>user-agent</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Giovambattista Fazioli</dc:creator><pubDate>Thu, 10 Dec 2009 16:30:28 PST</pubDate><guid isPermaLink="false">http://www.undolog.com/?p=2764</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/ruL5viNMynyZPiYRBzvy-8X6oRg/0/da"><img src="http://feedads.g.doubleclick.net/~a/ruL5viNMynyZPiYRBzvy-8X6oRg/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/ruL5viNMynyZPiYRBzvy-8X6oRg/1/da"><img src="http://feedads.g.doubleclick.net/~a/ruL5viNMynyZPiYRBzvy-8X6oRg/1/di" border="0" ismap="true"></img></a></p><p>Il nostro sito Web ormai non è visualizzato solo da postazioni PC. Con la diffusione del mobile, grazie soprattutto ad Apple iPhone, l'accesso al sito o blog viene sempre più spesso effettuato da dispositivi mobili di vario tipo. Diventa quindi esigenza di molti Web Developer saper intercettare ed identificare i diversi "agenti", cioè gli strumenti con cui un utente visualizza (naviga) le nostre pagine.<br />
Per Wordpress, ad esempio, che rappresenta una delle piattaforme Blog più diffuse, esistono da tempo Plugin che permettono di visualizzare in modo differente il nostro Blog in base al "device" che si utilizza. Questi Plugin non fanno altro che intercettare il tipo di dispositivo usato e re-indirizzare un tema appropriato. Chi possiede un Apple iPhone avrà infatti notato che alcuni Blog vengono visualizzati in modo totalmente differente, proprio grazie al cambio del tema effettuato da questi Plugin.<br />
La procedura, tuttavia, può essere generalizzata e applicata a qualsiasi pagina Web. Sfruttando PHP è possibile identificare l'agente e decidere che tipo di output emettere:</p>
<div class="igBar"><span id="lphp-72"><a href="#" onclick="javascript:showCodeTxt('php-72'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-72">
<div class="php" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// fornisce le informazioni sull'agente che ha richiesto</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// questa pagina</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_USER_AGENT'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// l'output sarà tipo:</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; it; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 </span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">?&gt;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Analizzando la stringa contenuta in <code>$_SERVER['HTTP_USER_AGENT']</code> è possibile identificare l'agente e comportarsi di conseguenza. Se ad esempio avete la necessità di mostrare un contenuto con un layout differente agli utenti Apple iPhone, potete inserire queste righe di codice nella vostra pagina PHP:</p>
<div class="igBar"><span id="lphp-73"><a href="#" onclick="javascript:showCodeTxt('php-73'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-73">
<div class="php" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <a href="http://www.php.net/eregi"><span style="color: #990000;">eregi</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'iphone'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_USER_AGENT'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Apple iPhone</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Tutti gli altri</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">?&gt;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Le combinazioni sono varie e, senza impazzire più di tanto, consiglio di scaricare questa piccola libreria (che poi non è nemmeno una libreria) scritta da <a target="_blank" href="http://detectmobilebrowsers.mobi/">Andy Moore</a>: <a target="_blank" href="http://detectmobilebrowsers.mobi/?dl">mobile_device_detect.php</a>.<br />
Il suo uso è davvero semplice e permette di intercettare moltissimi device: Apple iPhone/iPod, Android, Palm, ...<br />
Per utilizzarla basta includere il file <a target="_blank" href="http://detectmobilebrowsers.mobi/?dl">mobile_device_detect.php</a> e controllare il rotorno della funzione <code>mobile_device_detect()</code>:</p>
<div class="igBar"><span id="lphp-74"><a href="#" onclick="javascript:showCodeTxt('php-74'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-74">
<div class="php" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// ...</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">require_once</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mobile_device_detect.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000088;">$mobile</span> <span style="color: #339933;">=</span> mobile_device_detect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
La funzione accetta otto (8) parametri (opzionali) in ingresso che ne determinano il comportamento, compreso un re-direct nel caso sia stato trovato il device specificato nei parametri d'ingresso. Sul sito è disponibile anche un comodo <a target="_blank" href="http://detectmobilebrowsers.mobi/#generator">"generatore" di funzione</a> che chiarisce il funzionamento.</p>




	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F11%2Fbrowser-o-mobile-browser%2F&amp;title=Browser%20o%20Mobile%20Browser%3F&amp;bodytext=Il%20nostro%20sito%20Web%20ormai%20non%20%C3%A8%20visualizzato%20solo%20da%20postazioni%20PC.%20Con%20la%20diffusione%20del%20mobile%2C%20grazie%20soprattutto%20ad%20Apple%20iPhone%2C%20l%27accesso%20al%20sito%20o%20blog%20viene%20sempre%20pi%C3%B9%20spesso%20effettuato%20da%20dispositivi%20mobili%20di%20vario%20tipo.%20Diventa%20quindi%20esi" title="Digg"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F11%2Fbrowser-o-mobile-browser%2F&amp;title=Browser%20o%20Mobile%20Browser%3F&amp;notes=Il%20nostro%20sito%20Web%20ormai%20non%20%C3%A8%20visualizzato%20solo%20da%20postazioni%20PC.%20Con%20la%20diffusione%20del%20mobile%2C%20grazie%20soprattutto%20ad%20Apple%20iPhone%2C%20l%27accesso%20al%20sito%20o%20blog%20viene%20sempre%20pi%C3%B9%20spesso%20effettuato%20da%20dispositivi%20mobili%20di%20vario%20tipo.%20Diventa%20quindi%20esi" title="del.icio.us"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F11%2Fbrowser-o-mobile-browser%2F" title="Technorati"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F11%2Fbrowser-o-mobile-browser%2F&amp;t=Browser%20o%20Mobile%20Browser%3F" title="Facebook"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F11%2Fbrowser-o-mobile-browser%2F&amp;title=Browser%20o%20Mobile%20Browser%3F&amp;annotation=Il%20nostro%20sito%20Web%20ormai%20non%20%C3%A8%20visualizzato%20solo%20da%20postazioni%20PC.%20Con%20la%20diffusione%20del%20mobile%2C%20grazie%20soprattutto%20ad%20Apple%20iPhone%2C%20l%27accesso%20al%20sito%20o%20blog%20viene%20sempre%20pi%C3%B9%20spesso%20effettuato%20da%20dispositivi%20mobili%20di%20vario%20tipo.%20Diventa%20quindi%20esi" title="Google Bookmarks"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Browser%20o%20Mobile%20Browser%3F%20-%20http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F11%2Fbrowser-o-mobile-browser%2F" title="Twitter"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://barrapunto.com/submit.pl?subj=Browser%20o%20Mobile%20Browser%3F&amp;story=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F11%2Fbrowser-o-mobile-browser%2F" title="BarraPunto"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://current.com/clipper.htm?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F11%2Fbrowser-o-mobile-browser%2F&amp;title=Browser%20o%20Mobile%20Browser%3F" title="Current"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/current.png" title="Current" alt="Current" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=Browser%20o%20Mobile%20Browser%3F&amp;body=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F11%2Fbrowser-o-mobile-browser%2F" title="email"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Browser%20o%20Mobile%20Browser%3F&amp;link=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F11%2Fbrowser-o-mobile-browser%2F" title="FriendFeed"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://laaik.it/NewStoryCompact.aspx?uri=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F11%2Fbrowser-o-mobile-browser%2F&amp;headline=Browser%20o%20Mobile%20Browser%3F&amp;cat=5e082fcc-8a3b-47e2-acec-fdf64ff19d12" title="laaik.it"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/laaikit.png" title="laaik.it" alt="laaik.it" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F11%2Fbrowser-o-mobile-browser%2F&amp;title=Browser%20o%20Mobile%20Browser%3F&amp;source=Undolog.com+Research+%26amp%3B+Development++Blog&amp;summary=Il%20nostro%20sito%20Web%20ormai%20non%20%C3%A8%20visualizzato%20solo%20da%20postazioni%20PC.%20Con%20la%20diffusione%20del%20mobile%2C%20grazie%20soprattutto%20ad%20Apple%20iPhone%2C%20l%27accesso%20al%20sito%20o%20blog%20viene%20sempre%20pi%C3%B9%20spesso%20effettuato%20da%20dispositivi%20mobili%20di%20vario%20tipo.%20Diventa%20quindi%20esi" title="LinkedIn"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F11%2Fbrowser-o-mobile-browser%2F&amp;title=Browser%20o%20Mobile%20Browser%3F" title="Live"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F11%2Fbrowser-o-mobile-browser%2F&amp;t=Browser%20o%20Mobile%20Browser%3F" title="MySpace"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Browser%20o%20Mobile%20Browser%3F&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F11%2Fbrowser-o-mobile-browser%2F" title="Netvibes"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F11%2Fbrowser-o-mobile-browser%2F&amp;partner=sociable" title="Print"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.undolog.com/feed/" title="RSS"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://segnalo.alice.it/post.html.php?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F11%2Fbrowser-o-mobile-browser%2F&amp;title=Browser%20o%20Mobile%20Browser%3F" title="Segnalo"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/segnalo.png" title="Segnalo" alt="Segnalo" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F11%2Fbrowser-o-mobile-browser%2F&amp;title=Browser%20o%20Mobile%20Browser%3F" title="StumbleUpon"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.wikio.it/vote?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F11%2Fbrowser-o-mobile-browser%2F" title="Wikio IT"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/wikio.png" title="Wikio IT" alt="Wikio IT" class="sociable-hovers" /></a>


<br/><br/>
	Tags: <a href="http://www.undolog.com/tag/_serverhttp_user_agent/" title="$_SERVER[&#039;HTTP_USER_AGENT&#039;]" rel="tag">$_SERVER[&#039;HTTP_USER_AGENT&#039;]</a>, <a href="http://www.undolog.com/tag/apple-iphone/" title="Apple iPhone" rel="tag">Apple iPhone</a>, <a href="http://www.undolog.com/tag/browser/" title="browser" rel="tag">browser</a>, <a href="http://www.undolog.com/tag/device/" title="Device" rel="tag">Device</a>, <a href="http://www.undolog.com/category/sviluppo/internet/" title="Internet" rel="tag">Internet</a>, <a href="http://www.undolog.com/category/sviluppo/iphone-sviluppo/" title="iPhone" rel="tag">iPhone</a>, <a href="http://www.undolog.com/tag/ipod/" title="iPod" rel="tag">iPod</a>, <a href="http://www.undolog.com/tag/layout/" title="Layout" rel="tag">Layout</a>, <a href="http://www.undolog.com/category/mobile/" title="Mobile" rel="tag">Mobile</a>, <a href="http://www.undolog.com/tag/mobile/" title="Mobile" rel="tag">Mobile</a>, <a href="http://www.undolog.com/category/sviluppo/internet/php/" title="PHP" rel="tag">PHP</a>, <a href="http://www.undolog.com/tag/php/" title="PHP" rel="tag">PHP</a>, <a href="http://www.undolog.com/tag/plugin/" title="Plugin" rel="tag">Plugin</a>, <a href="http://www.undolog.com/category/sviluppo/" title="Sviluppo" rel="tag">Sviluppo</a>, <a href="http://www.undolog.com/tag/tema/" title="Tema" rel="tag">Tema</a>, <a href="http://www.undolog.com/tag/user-agent/" title="user-agent" rel="tag">user-agent</a>, <a href="http://www.undolog.com/category/sviluppo/internet/wordpress/" title="WordPress" rel="tag">WordPress</a>, <a href="http://www.undolog.com/tag/wordpress/" title="WordPress" rel="tag">WordPress</a><br />

	<h4>Post correlati</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.undolog.com/2008/10/03/wordpress-come-scrivere-un-reply-to-comment-usando-jquery/" title="Wordpress: come scrivere un reply to comment usando jQuery (3 ottobre, 2008)">Wordpress: come scrivere un reply to comment usando jQuery</a> (18)</li>
	<li><a href="http://www.undolog.com/2009/06/04/un-tema-wordpress-per-tutti/" title="Un tema Wordpress per tutti (4 giugno, 2009)">Un tema Wordpress per tutti</a> (20)</li>
	<li><a href="http://www.undolog.com/2008/10/27/wordpress-scrivere-un-logout-personale/" title="Wordpress: scrivere un logout personale (27 ottobre, 2008)">Wordpress: scrivere un logout personale</a> (1)</li>
	<li><a href="http://www.undolog.com/2008/11/01/wordpress-rimuovere-i-menu-dellamministrazione/" title="Wordpress: rimuovere i menu dell&#8217;amministrazione (1 novembre, 2008)">Wordpress: rimuovere i menu dell&#8217;amministrazione</a> (12)</li>
	<li><a href="http://www.undolog.com/2009/02/09/wordpress-personalizzare-la-navigazione-tra-i-post/" title="Wordpress: personalizzare la navigazione tra i post (9 febbraio, 2009)">Wordpress: personalizzare la navigazione tra i post</a> (5)</li>
</ul>

<img src="http://feeds.feedburner.com/~r/undolog/~4/7Y_qhMIoyYE" height="1" width="1"/>]]></content:encoded><description>Il nostro sito Web ormai non è visualizzato solo da postazioni PC. Con la diffusione del mobile, grazie soprattutto ad Apple iPhone, l'accesso al sito o blog viene sempre più spesso effettuato da dispositivi mobili di vario tipo. Diventa quindi esigenza di molti Web Developer saper intercettare ed identificare i diversi "agenti", cioè gli strumenti [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.undolog.com/2009/12/11/browser-o-mobile-browser/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">3</slash:comments><feedburner:origLink>http://www.undolog.com/2009/12/11/browser-o-mobile-browser/</feedburner:origLink></item><item><title>Personalizzare graficamente un Form</title><link>http://feedproxy.google.com/~r/undolog/~3/Z-sDZVNP2lM/</link><category>CSS</category><category>Internet</category><category>Sviluppo</category><category>Tutorials</category><category>-moz-border-radius</category><category>-webkit-border-radius</category><category>background-image</category><category>CSS3</category><category>form</category><category>Style Sheet</category><category>WebKit</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Giovambattista Fazioli</dc:creator><pubDate>Fri, 04 Dec 2009 05:52:34 PST</pubDate><guid isPermaLink="false">http://www.undolog.com/?p=2724</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/lGSTbd4XMab7tuI13D4foGTBfeA/0/da"><img src="http://feedads.g.doubleclick.net/~a/lGSTbd4XMab7tuI13D4foGTBfeA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/lGSTbd4XMab7tuI13D4foGTBfeA/1/da"><img src="http://feedads.g.doubleclick.net/~a/lGSTbd4XMab7tuI13D4foGTBfeA/1/di" border="0" ismap="true"></img></a></p><p>Mi è stato chiesto come personalizzare graficamente un form, in particolare un form di ricerca come quello presente su questo blog. La tecnica utilizzata, o meglio che utilizzo io, è ovviamente valida per qualsiasi tipo di modulo form. Quello che cambia è solo la complessità del lavoro da svolgere in funzione della complessità del form stesso.</p>
<h4>Le basi</h4>
<p>Tramite i fogli di stile è possibile personalizzare completamente il layout di un qualsiasi modulo form. Uno degli ostacoli che si possono incontrare, come spesso accade, è relativo alla compatibilità con i vari browser in commercio e quindi con diversi risultati finali in base al browser utilizzato.<br />
Per questo, spesso, si opta per una soluzione sostanzialmente grafica, cioè si sfruttano delle immagini per ridefinire il layout grafico del form. Le immagini, infatti, sono le uniche entità che, salvo rai casi, sino ad oggi sono visualizzate sempre allo stesso modo su tutti i browser.</p>
<h4>Senza immagini</h4>
<p>Prima di vedere come alterare il layout di un form con delle immagini, vediamo quello che "sarebbe" possibile fare con i soli CSS. Un modulo form è formato nella maggiornza dei casi da campi <code>INPUT</code>. Tuttavia quello che vedremo è, in linea generale, applicabile a qualsiasi altro campo modulo. Tramite i CSS possiamo ridefinire l'aspetto del nostro campo <code>INPUT</code> agendo sulla sua dimensione, sul bordo, sullo sfondo, sul tipo di carattere, etc...<br />
Ad esempio è possibile migliorare la resa impostando semplicemente:</p>
<div class="igBar"><span id="lcss-82"><a href="#" onclick="javascript:showCodeTxt('css-82'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-82">
<div class="css" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">input <span style="color: #00AA00;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#aaa</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">4px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">200px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">12px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #00AA00;">&#125;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Mozilla FireFox e Safari permettono anche di regolare in modo semplice la rotondità dei bordi (vedi anche <em><a href="http://www.undolog.com/2008/10/16/css3-qualcuno-ha-visto-internet-explorer/">CSS3: qualcuno ha visto Internet Explorer?</a></em>):</p>
<div class="igBar"><span id="lcss-83"><a href="#" onclick="javascript:showCodeTxt('css-83'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-83">
<div class="css" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">input <span style="color: #00AA00;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#aaa</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">4px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">200px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">12px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; -moz-border-radius<span style="color: #00AA00;">:</span><span style="color: #933;">6px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; -webkit-border-radius<span style="color: #00AA00;">:</span><span style="color: #933;">6px</span><span style="color: #00AA00;">;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
In aggiunta possiamo inserire un'immagine come sfondo, per rendere più "accessibile" il significato del campo stesso:</p>
<div class="igBar"><span id="lcss-84"><a href="#" onclick="javascript:showCodeTxt('css-84'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-84">
<div class="css" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">input <span style="color: #00AA00;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#aaa</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">4px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">200px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">12px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; -moz-border-radius<span style="color: #00AA00;">:</span><span style="color: #933;">6px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; -webkit-border-radius<span style="color: #00AA00;">:</span><span style="color: #933;">6px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/icon.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">20px</span><span style="color: #00AA00;">;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Se <code>icon.png</code> è un'icona di larghezza 16 pixel, tramite il <code>padding</code> permettiamo di posizionarla all'inizio del campo ma fuori dal testo.</p>
<h4>Le immagini nel Form</h4>
<p>L'ultimo esempio visto porterebbe ad una semplice soluzione nel momento in cui decidiamo di realizzare il layout del nostro campo <code>INPUT</code> completamene in grafica. Infatti in linea teorica basterebbe eliminare il bordo del campo e inserire un'immagine di background direttamente nel campo <code>INPUT</code>:</p>
<div class="igBar"><span id="lcss-85"><a href="#" onclick="javascript:showCodeTxt('css-85'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-85">
<div class="css" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">input <span style="color: #00AA00;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">4px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">200px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">12px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/custominput.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Dico in linea teorica perchè se da un lato questa tecnica funziona (vedi FireFox), dall'altro produce strani effetti su altri browser (vedi Microsoft Internet Explorer).<br />
Per sperare l'ostacolo si rende completamente trasparente il campo <code>INPUT</code> e l'immagine la si associa direttamente al tag <code>FORM</code>:</p>
<div class="igBar"><span id="lcss-86"><a href="#" onclick="javascript:showCodeTxt('css-86'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-86">
<div class="css" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">input <span style="color: #00AA00;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">4px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">200px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">12px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #00AA00;">&#125;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">form <span style="color: #00AA00;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">200px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">24px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/custominput.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #00AA00;">&#125;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Il tutto con una "taggatura" HTML del tipo:</p>
<div class="igBar"><span id="lhtml-87"><a href="#" onclick="javascript:showCodeTxt('html-87'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-87">
<div class="html" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><a href="http://december.com/html/4/element/%26amp%3Blt%3CSEMI%3Eform%26amp%3Bgt%3CSEMI%3E.html"><span style="color: #000000; font-weight: bold;">&lt;form&gt;</span></a></span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/%26amp%3Blt%3CSEMI%3Einput.html"><span style="color: #000000; font-weight: bold;">&lt;input</span></a> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;cerca&quot;</span> <span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/%26amp%3Bgt%3CSEMI%3E.html"><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><a href="http://december.com/html/4/element/%26amp%3Blt%3CSEMI%3E%2Fform%26amp%3Bgt%3CSEMI%3E.html"><span style="color: #000000; font-weight: bold;">&lt;/form&gt;</span></a></span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
In base alla grafica scelta e alla complessità del form, bisognerà solo "sovrapporre" in modo corretto, e quindi posizionare, il campo <code>INPUT</code> all'immagine grafica sottostante posta come sfondo del form. Questo è possibile inserendo gli opportuni margini al campo <code>INPUT</code> stesso, per farlo coincidere con il nostro layout: </p>
<div class="igBar"><span id="lcss-88"><a href="#" onclick="javascript:showCodeTxt('css-88'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-88">
<div class="css" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">input <span style="color: #00AA00;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">4px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">200px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">12px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span><span style="color: #933;">12px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">margin-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">24px</span><span style="color: #00AA00;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #00AA00;">&#125;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>




	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fpersonalizzare-graficamente-un-form%2F&amp;title=Personalizzare%20graficamente%20un%20Form&amp;bodytext=Mi%20%C3%A8%20stato%20chiesto%20come%20personalizzare%20graficamente%20un%20form%2C%20in%20particolare%20un%20form%20di%20ricerca%20come%20quello%20presente%20su%20questo%20blog.%20La%20tecnica%20utilizzata%2C%20o%20meglio%20che%20utilizzo%20io%2C%20%C3%A8%20ovviamente%20valida%20per%20qualsiasi%20tipo%20di%20modulo%20form.%20Quello%20che%20c" title="Digg"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fpersonalizzare-graficamente-un-form%2F&amp;title=Personalizzare%20graficamente%20un%20Form&amp;notes=Mi%20%C3%A8%20stato%20chiesto%20come%20personalizzare%20graficamente%20un%20form%2C%20in%20particolare%20un%20form%20di%20ricerca%20come%20quello%20presente%20su%20questo%20blog.%20La%20tecnica%20utilizzata%2C%20o%20meglio%20che%20utilizzo%20io%2C%20%C3%A8%20ovviamente%20valida%20per%20qualsiasi%20tipo%20di%20modulo%20form.%20Quello%20che%20c" title="del.icio.us"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fpersonalizzare-graficamente-un-form%2F" title="Technorati"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fpersonalizzare-graficamente-un-form%2F&amp;t=Personalizzare%20graficamente%20un%20Form" title="Facebook"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fpersonalizzare-graficamente-un-form%2F&amp;title=Personalizzare%20graficamente%20un%20Form&amp;annotation=Mi%20%C3%A8%20stato%20chiesto%20come%20personalizzare%20graficamente%20un%20form%2C%20in%20particolare%20un%20form%20di%20ricerca%20come%20quello%20presente%20su%20questo%20blog.%20La%20tecnica%20utilizzata%2C%20o%20meglio%20che%20utilizzo%20io%2C%20%C3%A8%20ovviamente%20valida%20per%20qualsiasi%20tipo%20di%20modulo%20form.%20Quello%20che%20c" title="Google Bookmarks"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Personalizzare%20graficamente%20un%20Form%20-%20http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fpersonalizzare-graficamente-un-form%2F" title="Twitter"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://barrapunto.com/submit.pl?subj=Personalizzare%20graficamente%20un%20Form&amp;story=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fpersonalizzare-graficamente-un-form%2F" title="BarraPunto"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://current.com/clipper.htm?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fpersonalizzare-graficamente-un-form%2F&amp;title=Personalizzare%20graficamente%20un%20Form" title="Current"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/current.png" title="Current" alt="Current" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=Personalizzare%20graficamente%20un%20Form&amp;body=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fpersonalizzare-graficamente-un-form%2F" title="email"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Personalizzare%20graficamente%20un%20Form&amp;link=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fpersonalizzare-graficamente-un-form%2F" title="FriendFeed"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://laaik.it/NewStoryCompact.aspx?uri=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fpersonalizzare-graficamente-un-form%2F&amp;headline=Personalizzare%20graficamente%20un%20Form&amp;cat=5e082fcc-8a3b-47e2-acec-fdf64ff19d12" title="laaik.it"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/laaikit.png" title="laaik.it" alt="laaik.it" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fpersonalizzare-graficamente-un-form%2F&amp;title=Personalizzare%20graficamente%20un%20Form&amp;source=Undolog.com+Research+%26amp%3B+Development++Blog&amp;summary=Mi%20%C3%A8%20stato%20chiesto%20come%20personalizzare%20graficamente%20un%20form%2C%20in%20particolare%20un%20form%20di%20ricerca%20come%20quello%20presente%20su%20questo%20blog.%20La%20tecnica%20utilizzata%2C%20o%20meglio%20che%20utilizzo%20io%2C%20%C3%A8%20ovviamente%20valida%20per%20qualsiasi%20tipo%20di%20modulo%20form.%20Quello%20che%20c" title="LinkedIn"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fpersonalizzare-graficamente-un-form%2F&amp;title=Personalizzare%20graficamente%20un%20Form" title="Live"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fpersonalizzare-graficamente-un-form%2F&amp;t=Personalizzare%20graficamente%20un%20Form" title="MySpace"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Personalizzare%20graficamente%20un%20Form&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fpersonalizzare-graficamente-un-form%2F" title="Netvibes"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fpersonalizzare-graficamente-un-form%2F&amp;partner=sociable" title="Print"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.undolog.com/feed/" title="RSS"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://segnalo.alice.it/post.html.php?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fpersonalizzare-graficamente-un-form%2F&amp;title=Personalizzare%20graficamente%20un%20Form" title="Segnalo"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/segnalo.png" title="Segnalo" alt="Segnalo" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fpersonalizzare-graficamente-un-form%2F&amp;title=Personalizzare%20graficamente%20un%20Form" title="StumbleUpon"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.wikio.it/vote?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fpersonalizzare-graficamente-un-form%2F" title="Wikio IT"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/wikio.png" title="Wikio IT" alt="Wikio IT" class="sociable-hovers" /></a>


<br/><br/>
	Tags: <a href="http://www.undolog.com/tag/moz-border-radius/" title="-moz-border-radius" rel="tag">-moz-border-radius</a>, <a href="http://www.undolog.com/tag/webkit-border-radius/" title="-webkit-border-radius" rel="tag">-webkit-border-radius</a>, <a href="http://www.undolog.com/tag/background-image/" title="background-image" rel="tag">background-image</a>, <a href="http://www.undolog.com/category/sviluppo/internet/css/" title="CSS" rel="tag">CSS</a>, <a href="http://www.undolog.com/tag/css/" title="CSS" rel="tag">CSS</a>, <a href="http://www.undolog.com/tag/css3/" title="CSS3" rel="tag">CSS3</a>, <a href="http://www.undolog.com/tag/form/" title="form" rel="tag">form</a>, <a href="http://www.undolog.com/category/sviluppo/internet/" title="Internet" rel="tag">Internet</a>, <a href="http://www.undolog.com/tag/style-sheet/" title="Style Sheet" rel="tag">Style Sheet</a>, <a href="http://www.undolog.com/category/sviluppo/" title="Sviluppo" rel="tag">Sviluppo</a>, <a href="http://www.undolog.com/category/tutorials/" title="Tutorials" rel="tag">Tutorials</a>, <a href="http://www.undolog.com/tag/webkit/" title="WebKit" rel="tag">WebKit</a><br />

	<h4>Post correlati</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.undolog.com/2010/01/21/firefox-3-5-7-come-risolvere-il-difetto-dei-bordi-arrotondati-su-unimmagine/" title="FireFox 3.5.7: come risolvere il difetto dei bordi arrotondati su un&#8217;immagine (21 gennaio, 2010)">FireFox 3.5.7: come risolvere il difetto dei bordi arrotondati su un&#8217;immagine</a> (1)</li>
	<li><a href="http://www.undolog.com/2008/10/16/css3-qualcuno-ha-visto-internet-explorer/" title="CSS3: qualcuno ha visto Internet Explorer? (16 ottobre, 2008)">CSS3: qualcuno ha visto Internet Explorer?</a> (5)</li>
	<li><a href="http://www.undolog.com/2008/11/10/very-short-trick-versatilita-delle-classi-css/" title="Very short trick: versatilità delle classi CSS (10 novembre, 2008)">Very short trick: versatilità delle classi CSS</a> (3)</li>
	<li><a href="http://www.undolog.com/2009/02/05/very-short-trick-disabilitare-il-ridimensionamento-di-una-textarea-su-safari/" title="Very short trick: disabilitare il ridimensionamento di una textarea su Safari (5 febbraio, 2009)">Very short trick: disabilitare il ridimensionamento di una textarea su Safari</a> (7)</li>
	<li><a href="http://www.undolog.com/2009/05/18/very-short-trick-css-condizionali-e-ottimizzazione/" title="Very short trick: CSS condizionali e ottimizzazione (18 maggio, 2009)">Very short trick: CSS condizionali e ottimizzazione</a> (1)</li>
</ul>

<img src="http://feeds.feedburner.com/~r/undolog/~4/Z-sDZVNP2lM" height="1" width="1"/>]]></content:encoded><description>Mi è stato chiesto come personalizzare graficamente un form, in particolare un form di ricerca come quello presente su questo blog. La tecnica utilizzata, o meglio che utilizzo io, è ovviamente valida per qualsiasi tipo di modulo form. Quello che cambia è solo la complessità del lavoro da svolgere in funzione della complessità del form [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.undolog.com/2009/12/04/personalizzare-graficamente-un-form/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">5</slash:comments><feedburner:origLink>http://www.undolog.com/2009/12/04/personalizzare-graficamente-un-form/</feedburner:origLink></item><item><title>Wordpress: visualizzare gli ultimi topic di bbPress</title><link>http://feedproxy.google.com/~r/undolog/~3/jsZZCC3ygxw/</link><category>Internet</category><category>PHP</category><category>Sviluppo</category><category>WordPress</category><category>bbPress</category><category>Forum</category><category>word_cut_for_chars()</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Giovambattista Fazioli</dc:creator><pubDate>Fri, 04 Dec 2009 05:16:55 PST</pubDate><guid isPermaLink="false">http://www.undolog.com/?p=2475</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/PsSjvAQPkaR-eaOas64AcgQCYR0/0/da"><img src="http://feedads.g.doubleclick.net/~a/PsSjvAQPkaR-eaOas64AcgQCYR0/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/PsSjvAQPkaR-eaOas64AcgQCYR0/1/da"><img src="http://feedads.g.doubleclick.net/~a/PsSjvAQPkaR-eaOas64AcgQCYR0/1/di" border="0" ismap="true"></img></a></p><p><a href="http://www.undolog.com/2009/09/28/bbpress-integrare-e-utilizzare-le-funzioni-di-wordpress/">Abbiamo visto</a> come integrate il kernel di Wordpress in <a target="_blank" href="http://bbpress.org/">bbPress</a>, per usare ad esempio qualche funzione Wordpress o condividere il tema. Ora vedremo il contraio, cioè come mostrare le informazioni del forum bbPress nella Home Page di Wordpress. Per fare questa operazione esistono alcuni Plugin (alcuni funzionanti e altri no). Noi qui vedremo invece come scrivere una - davvero - semplice funzione che, in caso, può essere migliorata e perfezionata per tutti i casi.</p>
<div class="igBar"><span id="lphp-90"><a href="#" onclick="javascript:showCodeTxt('php-90'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-90">
<div class="php" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">/**</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;* Mostra le ultime discussioni dal forum bbpress</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;* </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;* @author&nbsp; =undo=</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;* @date&nbsp; &nbsp; 2009-09-11</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;* </div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;* @return </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;*/</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">function bbpress_wp_get_last_topics($limit = 10) {</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; global $wpdb;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; // connessione al database - modificare i parametri con i propri</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; // dati di accesso al dabase mysql </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; $db_bbpress = new wpdb('bbpress', 'bbpress', 'bbpress', 'localhost');</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; $query &nbsp; &nbsp; &nbsp;= &quot;SELECT * FROM bb_posts JOIN bb_forums ON bb_posts.post_status = '0' AND bb_posts.forum_id = bb_forums.forum_id JOIN bb_topics ON bb_posts.topic_id = bb_topics.topic_id ORDER BY bb_posts.post_time DESC LIMIT 0,&quot; . $limit;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; $list_topics= $db_bbpress-&gt;get_results( $query );</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; foreach( $list_topics as $topic) : ?&gt;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;div class=&quot;forum&quot;&gt;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;p&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$topic</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">topic_last_poster_name</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> - <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <a href="http://www.php.net/date_format"><span style="color: #990000;">date_format</span></a><span style="color: #009900;">&#40;</span> <a href="http://www.php.net/date_create"><span style="color: #990000;">date_create</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$topic</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_time</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'d.m.Y'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/p&gt;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;h2&gt;&lt;a href=&quot;/forum/topic.php?id=<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$topic</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">topic_id</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; title=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$topic</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">topic_title</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$topic</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">topic_title</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/h2&gt;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;p&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> word_cut_for_chars<span style="color: #009900;">&#40;</span> <a href="http://www.php.net/strip_tags"><span style="color: #990000;">strip_tags</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$topic</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_text</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;b&gt;&lt;strong&gt;&lt;i&gt;&lt;u&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;color:#800000;">100</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/p&gt;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Alcune note:</p>
<ul>
<li>Nell'esempio si evince che il database di <strong>bbPress</strong> è "esterno", cioè non è possibile utilizzare la stessa connessione messa già a disposizione dal core di Wordpress. Tuttavia <strong>bbPress</strong> può essere installato anche sullo stesso database di Wordpress. Così facendo non è necessaria la connessione ma è possibile utilizzare direttamente l'oggetto (globale) <code>$wpdb</code></li>
<li>Il link <code>"/forum/..."</code> si riferisce alla vostra path di installazione: normalmente <code>www.dominio.com/forum</code></li>
<li>La funzione <code>word_cut_for_chars()</code> taglia una stringa contando i caratteri; trovate il sorgente in <em><a href="http://www.undolog.com/2009/09/14/very-short-snippet-php-tagliare-a-parole-contando-i-caratteri/">Very short snippet: PHP, tagliare a parole, contando i caratteri</a></em></li>
</ul>




	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fwordpress-visualizzare-gli-ultimi-topic-di-bbpress%2F&amp;title=Wordpress%3A%20visualizzare%20gli%20ultimi%20topic%20di%20bbPress&amp;bodytext=Abbiamo%20visto%20come%20integrate%20il%20kernel%20di%20Wordpress%20in%20bbPress%2C%20per%20usare%20ad%20esempio%20qualche%20funzione%20Wordpress%20o%20condividere%20il%20tema.%20Ora%20vedremo%20il%20contraio%2C%20cio%C3%A8%20come%20mostrare%20le%20informazioni%20del%20forum%20bbPress%20nella%20Home%20Page%20di%20Wordpress.%20Per%20fa" title="Digg"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fwordpress-visualizzare-gli-ultimi-topic-di-bbpress%2F&amp;title=Wordpress%3A%20visualizzare%20gli%20ultimi%20topic%20di%20bbPress&amp;notes=Abbiamo%20visto%20come%20integrate%20il%20kernel%20di%20Wordpress%20in%20bbPress%2C%20per%20usare%20ad%20esempio%20qualche%20funzione%20Wordpress%20o%20condividere%20il%20tema.%20Ora%20vedremo%20il%20contraio%2C%20cio%C3%A8%20come%20mostrare%20le%20informazioni%20del%20forum%20bbPress%20nella%20Home%20Page%20di%20Wordpress.%20Per%20fa" title="del.icio.us"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fwordpress-visualizzare-gli-ultimi-topic-di-bbpress%2F" title="Technorati"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fwordpress-visualizzare-gli-ultimi-topic-di-bbpress%2F&amp;t=Wordpress%3A%20visualizzare%20gli%20ultimi%20topic%20di%20bbPress" title="Facebook"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fwordpress-visualizzare-gli-ultimi-topic-di-bbpress%2F&amp;title=Wordpress%3A%20visualizzare%20gli%20ultimi%20topic%20di%20bbPress&amp;annotation=Abbiamo%20visto%20come%20integrate%20il%20kernel%20di%20Wordpress%20in%20bbPress%2C%20per%20usare%20ad%20esempio%20qualche%20funzione%20Wordpress%20o%20condividere%20il%20tema.%20Ora%20vedremo%20il%20contraio%2C%20cio%C3%A8%20come%20mostrare%20le%20informazioni%20del%20forum%20bbPress%20nella%20Home%20Page%20di%20Wordpress.%20Per%20fa" title="Google Bookmarks"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Wordpress%3A%20visualizzare%20gli%20ultimi%20topic%20di%20bbPress%20-%20http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fwordpress-visualizzare-gli-ultimi-topic-di-bbpress%2F" title="Twitter"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://barrapunto.com/submit.pl?subj=Wordpress%3A%20visualizzare%20gli%20ultimi%20topic%20di%20bbPress&amp;story=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fwordpress-visualizzare-gli-ultimi-topic-di-bbpress%2F" title="BarraPunto"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://current.com/clipper.htm?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fwordpress-visualizzare-gli-ultimi-topic-di-bbpress%2F&amp;title=Wordpress%3A%20visualizzare%20gli%20ultimi%20topic%20di%20bbPress" title="Current"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/current.png" title="Current" alt="Current" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=Wordpress%3A%20visualizzare%20gli%20ultimi%20topic%20di%20bbPress&amp;body=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fwordpress-visualizzare-gli-ultimi-topic-di-bbpress%2F" title="email"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Wordpress%3A%20visualizzare%20gli%20ultimi%20topic%20di%20bbPress&amp;link=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fwordpress-visualizzare-gli-ultimi-topic-di-bbpress%2F" title="FriendFeed"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://laaik.it/NewStoryCompact.aspx?uri=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fwordpress-visualizzare-gli-ultimi-topic-di-bbpress%2F&amp;headline=Wordpress%3A%20visualizzare%20gli%20ultimi%20topic%20di%20bbPress&amp;cat=5e082fcc-8a3b-47e2-acec-fdf64ff19d12" title="laaik.it"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/laaikit.png" title="laaik.it" alt="laaik.it" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fwordpress-visualizzare-gli-ultimi-topic-di-bbpress%2F&amp;title=Wordpress%3A%20visualizzare%20gli%20ultimi%20topic%20di%20bbPress&amp;source=Undolog.com+Research+%26amp%3B+Development++Blog&amp;summary=Abbiamo%20visto%20come%20integrate%20il%20kernel%20di%20Wordpress%20in%20bbPress%2C%20per%20usare%20ad%20esempio%20qualche%20funzione%20Wordpress%20o%20condividere%20il%20tema.%20Ora%20vedremo%20il%20contraio%2C%20cio%C3%A8%20come%20mostrare%20le%20informazioni%20del%20forum%20bbPress%20nella%20Home%20Page%20di%20Wordpress.%20Per%20fa" title="LinkedIn"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fwordpress-visualizzare-gli-ultimi-topic-di-bbpress%2F&amp;title=Wordpress%3A%20visualizzare%20gli%20ultimi%20topic%20di%20bbPress" title="Live"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fwordpress-visualizzare-gli-ultimi-topic-di-bbpress%2F&amp;t=Wordpress%3A%20visualizzare%20gli%20ultimi%20topic%20di%20bbPress" title="MySpace"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Wordpress%3A%20visualizzare%20gli%20ultimi%20topic%20di%20bbPress&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fwordpress-visualizzare-gli-ultimi-topic-di-bbpress%2F" title="Netvibes"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fwordpress-visualizzare-gli-ultimi-topic-di-bbpress%2F&amp;partner=sociable" title="Print"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.undolog.com/feed/" title="RSS"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://segnalo.alice.it/post.html.php?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fwordpress-visualizzare-gli-ultimi-topic-di-bbpress%2F&amp;title=Wordpress%3A%20visualizzare%20gli%20ultimi%20topic%20di%20bbPress" title="Segnalo"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/segnalo.png" title="Segnalo" alt="Segnalo" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fwordpress-visualizzare-gli-ultimi-topic-di-bbpress%2F&amp;title=Wordpress%3A%20visualizzare%20gli%20ultimi%20topic%20di%20bbPress" title="StumbleUpon"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.wikio.it/vote?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fwordpress-visualizzare-gli-ultimi-topic-di-bbpress%2F" title="Wikio IT"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/wikio.png" title="Wikio IT" alt="Wikio IT" class="sociable-hovers" /></a>


<br/><br/>
	Tags: <a href="http://www.undolog.com/tag/bbpress/" title="bbPress" rel="tag">bbPress</a>, <a href="http://www.undolog.com/tag/forum/" title="Forum" rel="tag">Forum</a>, <a href="http://www.undolog.com/category/sviluppo/internet/" title="Internet" rel="tag">Internet</a>, <a href="http://www.undolog.com/category/sviluppo/internet/php/" title="PHP" rel="tag">PHP</a>, <a href="http://www.undolog.com/tag/php/" title="PHP" rel="tag">PHP</a>, <a href="http://www.undolog.com/category/sviluppo/" title="Sviluppo" rel="tag">Sviluppo</a>, <a href="http://www.undolog.com/category/sviluppo/internet/wordpress/" title="WordPress" rel="tag">WordPress</a>, <a href="http://www.undolog.com/tag/wordpress/" title="WordPress" rel="tag">WordPress</a>, <a href="http://www.undolog.com/tag/word_cut_for_chars/" title="word_cut_for_chars()" rel="tag">word_cut_for_chars()</a><br />

	<h4>Post correlati</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.undolog.com/2009/09/28/bbpress-integrare-e-utilizzare-le-funzioni-di-wordpress/" title="bbPress: integrare e utilizzare le funzioni di Wordpress (28 settembre, 2009)">bbPress: integrare e utilizzare le funzioni di Wordpress</a> (2)</li>
	<li><a href="http://www.undolog.com/2009/01/05/wordpress-wp_parse_args/" title="Wordpress: wp_parse_args() (5 gennaio, 2009)">Wordpress: wp_parse_args()</a> (3)</li>
	<li><a href="http://www.undolog.com/2009/07/03/wordpress-usare-gli-shortcodes/" title="Wordpress: usare gli shortcodes (3 luglio, 2009)">Wordpress: usare gli shortcodes</a> (5)</li>
	<li><a href="http://www.undolog.com/2008/10/27/wordpress-scrivere-un-logout-personale/" title="Wordpress: scrivere un logout personale (27 ottobre, 2008)">Wordpress: scrivere un logout personale</a> (1)</li>
	<li><a href="http://www.undolog.com/2008/11/01/wordpress-rimuovere-i-menu-dellamministrazione/" title="Wordpress: rimuovere i menu dell&#8217;amministrazione (1 novembre, 2008)">Wordpress: rimuovere i menu dell&#8217;amministrazione</a> (12)</li>
</ul>

<img src="http://feeds.feedburner.com/~r/undolog/~4/jsZZCC3ygxw" height="1" width="1"/>]]></content:encoded><description>Abbiamo visto come integrate il kernel di Wordpress in bbPress, per usare ad esempio qualche funzione Wordpress o condividere il tema. Ora vedremo il contraio, cioè come mostrare le informazioni del forum bbPress nella Home Page di Wordpress. Per fare questa operazione esistono alcuni Plugin (alcuni funzionanti e altri no). Noi qui vedremo invece come [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.undolog.com/2009/12/04/wordpress-visualizzare-gli-ultimi-topic-di-bbpress/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://www.undolog.com/2009/12/04/wordpress-visualizzare-gli-ultimi-topic-di-bbpress/</feedburner:origLink></item><item><title>Apple iPhone: creare un custom toggle button</title><link>http://feedproxy.google.com/~r/undolog/~3/BwPiFF4SHLw/</link><category>Mobile</category><category>Objective-C</category><category>iPhone</category><category>Apple</category><category>Apple iPhone</category><category>buttonWithType</category><category>CGRect</category><category>Immagini</category><category>initWithFrame</category><category>UIButton</category><category>UIControlStateHighlighted</category><category>UIControlStateSelected</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Giovambattista Fazioli</dc:creator><pubDate>Fri, 04 Dec 2009 03:00:05 PST</pubDate><guid isPermaLink="false">http://www.undolog.com/?p=2745</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/7I18z7ZA4cGyH876HC-tuphe1pI/0/da"><img src="http://feedads.g.doubleclick.net/~a/7I18z7ZA4cGyH876HC-tuphe1pI/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/7I18z7ZA4cGyH876HC-tuphe1pI/1/da"><img src="http://feedads.g.doubleclick.net/~a/7I18z7ZA4cGyH876HC-tuphe1pI/1/di" border="0" ismap="true"></img></a></p><p>Gli stati <code>UIControlStateSelected</code> o <code>UIControlStateHighlighted</code> non funzionano quando un <code>UIButton</code> è impostato in modalità <code>UIButtonTypeCustom</code>! O meglio, non funzionano come dovrebbero (perchè riservati agli altri tipi di bottone), ad esempio per creare un bottone a due stati: toggle appunto. Se abbiamo creato due immagini (stato1.png e stato2.png) per il nostro bottone, possiamo procedere in questo modo:</p>
<div class="igBar"><span id="lobjc-94"><a href="#" onclick="javascript:showCodeTxt('objc-94'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-94">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// Nell'header file creiamo una variabile globale che usaremo per</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// controllare il toggle state</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #a61390;">BOOL</span> toggleFlag;</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Ora creiamo il nostro bottone:</p>
<div class="igBar"><span id="lobjc-95"><a href="#" onclick="javascript:showCodeTxt('objc-95'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-95">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// Creaiamo un bottone e lo poniamo inizialmente nello stato &quot;stato1.png&quot;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// Modificate initWithFrame:(CGRect){100,100,50,50} con la posizione e </span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// dimensioni della vostra immmagine</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">toggleFlag <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">UIButton <span style="color: #002200;">*</span>toggleButton <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIButton buttonWithType<span style="color: #002200;">:</span>UIButtonTypeCustom<span style="color: #002200;">&#93;</span> initWithFrame<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>CGRect<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#123;</span>100,100,50,50<span style="color: #002200;">&#125;</span><span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span>toggleButton setTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span> forState<span style="color: #002200;">:</span>UIControlStateNormal<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span>toggleButton setBackgroundImage<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;stato1.png&quot;</span><span style="color: #002200;">&#93;</span> forState<span style="color: #002200;">:</span>UIControlStateNormal<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span>toggleButton addTarget<span style="color: #002200;">:</span>self action<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>onToggle<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span> forControlEvents<span style="color: #002200;">:</span>UIControlEventTouchUpInside<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span>self.view addSubview<span style="color: #002200;">:</span>toggleButton<span style="color: #002200;">&#93;</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Quando si clicca sul bottone verrà inviato un messaggio gestito da <code>onToggle</code>:</p>
<div class="igBar"><span id="lobjc-96"><a href="#" onclick="javascript:showCodeTxt('objc-96'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-96">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>onToggle<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>sender <span style="color: #002200;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// Recupero puntatore al UIButton</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">UIButton <span style="color: #002200;">*</span>buttonClicked <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span>UIButton <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>sender;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// Eseguo il toogle</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">toggleFlag <span style="color: #002200;">=</span> <span style="color: #002200;">!</span>toggleFlag;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span>buttonClicked setBackgroundImage<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>toggleFlag<span style="color: #002200;">&#41;</span> ? <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;stato1.png&quot;</span> <span style="color: #002200;">:</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;stato2.png&quot;</span><span style="color: #002200;">&#93;</span> forState<span style="color: #002200;">:</span>UIControlStateNormal<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#125;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>




	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fapple-iphone-creare-un-custom-toggle-button%2F&amp;title=Apple%20iPhone%3A%20creare%20un%20custom%20toggle%20button&amp;bodytext=Gli%20stati%20UIControlStateSelected%20o%20UIControlStateHighlighted%20non%20funzionano%20quando%20un%20UIButton%20%C3%A8%20impostato%20in%20modalit%C3%A0%20UIButtonTypeCustom%21%20O%20meglio%2C%20non%20funzionano%20come%20dovrebbero%20%28perch%C3%A8%20riservati%20agli%20altri%20tipi%20di%20bottone%29%2C%20ad%20esempio%20per%20crear" title="Digg"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fapple-iphone-creare-un-custom-toggle-button%2F&amp;title=Apple%20iPhone%3A%20creare%20un%20custom%20toggle%20button&amp;notes=Gli%20stati%20UIControlStateSelected%20o%20UIControlStateHighlighted%20non%20funzionano%20quando%20un%20UIButton%20%C3%A8%20impostato%20in%20modalit%C3%A0%20UIButtonTypeCustom%21%20O%20meglio%2C%20non%20funzionano%20come%20dovrebbero%20%28perch%C3%A8%20riservati%20agli%20altri%20tipi%20di%20bottone%29%2C%20ad%20esempio%20per%20crear" title="del.icio.us"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fapple-iphone-creare-un-custom-toggle-button%2F" title="Technorati"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fapple-iphone-creare-un-custom-toggle-button%2F&amp;t=Apple%20iPhone%3A%20creare%20un%20custom%20toggle%20button" title="Facebook"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fapple-iphone-creare-un-custom-toggle-button%2F&amp;title=Apple%20iPhone%3A%20creare%20un%20custom%20toggle%20button&amp;annotation=Gli%20stati%20UIControlStateSelected%20o%20UIControlStateHighlighted%20non%20funzionano%20quando%20un%20UIButton%20%C3%A8%20impostato%20in%20modalit%C3%A0%20UIButtonTypeCustom%21%20O%20meglio%2C%20non%20funzionano%20come%20dovrebbero%20%28perch%C3%A8%20riservati%20agli%20altri%20tipi%20di%20bottone%29%2C%20ad%20esempio%20per%20crear" title="Google Bookmarks"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Apple%20iPhone%3A%20creare%20un%20custom%20toggle%20button%20-%20http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fapple-iphone-creare-un-custom-toggle-button%2F" title="Twitter"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://barrapunto.com/submit.pl?subj=Apple%20iPhone%3A%20creare%20un%20custom%20toggle%20button&amp;story=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fapple-iphone-creare-un-custom-toggle-button%2F" title="BarraPunto"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://current.com/clipper.htm?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fapple-iphone-creare-un-custom-toggle-button%2F&amp;title=Apple%20iPhone%3A%20creare%20un%20custom%20toggle%20button" title="Current"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/current.png" title="Current" alt="Current" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=Apple%20iPhone%3A%20creare%20un%20custom%20toggle%20button&amp;body=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fapple-iphone-creare-un-custom-toggle-button%2F" title="email"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Apple%20iPhone%3A%20creare%20un%20custom%20toggle%20button&amp;link=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fapple-iphone-creare-un-custom-toggle-button%2F" title="FriendFeed"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://laaik.it/NewStoryCompact.aspx?uri=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fapple-iphone-creare-un-custom-toggle-button%2F&amp;headline=Apple%20iPhone%3A%20creare%20un%20custom%20toggle%20button&amp;cat=5e082fcc-8a3b-47e2-acec-fdf64ff19d12" title="laaik.it"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/laaikit.png" title="laaik.it" alt="laaik.it" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fapple-iphone-creare-un-custom-toggle-button%2F&amp;title=Apple%20iPhone%3A%20creare%20un%20custom%20toggle%20button&amp;source=Undolog.com+Research+%26amp%3B+Development++Blog&amp;summary=Gli%20stati%20UIControlStateSelected%20o%20UIControlStateHighlighted%20non%20funzionano%20quando%20un%20UIButton%20%C3%A8%20impostato%20in%20modalit%C3%A0%20UIButtonTypeCustom%21%20O%20meglio%2C%20non%20funzionano%20come%20dovrebbero%20%28perch%C3%A8%20riservati%20agli%20altri%20tipi%20di%20bottone%29%2C%20ad%20esempio%20per%20crear" title="LinkedIn"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fapple-iphone-creare-un-custom-toggle-button%2F&amp;title=Apple%20iPhone%3A%20creare%20un%20custom%20toggle%20button" title="Live"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fapple-iphone-creare-un-custom-toggle-button%2F&amp;t=Apple%20iPhone%3A%20creare%20un%20custom%20toggle%20button" title="MySpace"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Apple%20iPhone%3A%20creare%20un%20custom%20toggle%20button&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fapple-iphone-creare-un-custom-toggle-button%2F" title="Netvibes"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fapple-iphone-creare-un-custom-toggle-button%2F&amp;partner=sociable" title="Print"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.undolog.com/feed/" title="RSS"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://segnalo.alice.it/post.html.php?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fapple-iphone-creare-un-custom-toggle-button%2F&amp;title=Apple%20iPhone%3A%20creare%20un%20custom%20toggle%20button" title="Segnalo"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/segnalo.png" title="Segnalo" alt="Segnalo" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fapple-iphone-creare-un-custom-toggle-button%2F&amp;title=Apple%20iPhone%3A%20creare%20un%20custom%20toggle%20button" title="StumbleUpon"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.wikio.it/vote?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F04%2Fapple-iphone-creare-un-custom-toggle-button%2F" title="Wikio IT"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/wikio.png" title="Wikio IT" alt="Wikio IT" class="sociable-hovers" /></a>


<br/><br/>
	Tags: <a href="http://www.undolog.com/tag/apple/" title="Apple" rel="tag">Apple</a>, <a href="http://www.undolog.com/tag/apple-iphone/" title="Apple iPhone" rel="tag">Apple iPhone</a>, <a href="http://www.undolog.com/tag/buttonwithtype/" title="buttonWithType" rel="tag">buttonWithType</a>, <a href="http://www.undolog.com/tag/cgrect/" title="CGRect" rel="tag">CGRect</a>, <a href="http://www.undolog.com/tag/immagini/" title="Immagini" rel="tag">Immagini</a>, <a href="http://www.undolog.com/tag/initwithframe/" title="initWithFrame" rel="tag">initWithFrame</a>, <a href="http://www.undolog.com/tag/iphone/" title="iPhone" rel="tag">iPhone</a>, <a href="http://www.undolog.com/category/sviluppo/iphone-sviluppo/" title="iPhone" rel="tag">iPhone</a>, <a href="http://www.undolog.com/category/mobile/" title="Mobile" rel="tag">Mobile</a>, <a href="http://www.undolog.com/category/sviluppo/iphone-sviluppo/objective-c-sviluppo/" title="Objective-C" rel="tag">Objective-C</a>, <a href="http://www.undolog.com/tag/uibutton/" title="UIButton" rel="tag">UIButton</a>, <a href="http://www.undolog.com/tag/uicontrolstatehighlighted/" title="UIControlStateHighlighted" rel="tag">UIControlStateHighlighted</a>, <a href="http://www.undolog.com/tag/uicontrolstateselected/" title="UIControlStateSelected" rel="tag">UIControlStateSelected</a><br />

	<h4>Post correlati</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.undolog.com/2009/06/12/apple-iphone-sdk-30-risolto-baco-su-uibutton-buttonwithtype/" title="Apple iPhone SDK 3.0: risolto baco su UIButton buttonWithType (12 giugno, 2009)">Apple iPhone SDK 3.0: risolto baco su UIButton buttonWithType</a> (0)</li>
	<li><a href="http://www.undolog.com/2009/06/11/apple-iphone-sdk-30-prime-incompatibilita/" title="Apple iPhone SDK 3.0: prime incompatibilità (11 giugno, 2009)">Apple iPhone SDK 3.0: prime incompatibilità</a> (1)</li>
	<li><a href="http://www.undolog.com/2009/12/01/very-short-snippet-streaming-mp3-file-su-apple-iphone/" title="Very short snippet: streaming mp3 file su Apple iPhone (1 dicembre, 2009)">Very short snippet: streaming mp3 file su Apple iPhone</a> (0)</li>
	<li><a href="http://www.undolog.com/2009/07/27/objective-c-unalternativa-alluso-di-cgrectmake/" title="Objective-C: un&#8217;alternativa all&#8217;uso di CGRectMake (27 luglio, 2009)">Objective-C: un&#8217;alternativa all&#8217;uso di CGRectMake</a> (2)</li>
	<li><a href="http://www.undolog.com/2009/10/29/objective-c-nslog-su-struct-c/" title="Objective-C: NSLog() su struct C (29 ottobre, 2009)">Objective-C: NSLog() su struct C</a> (0)</li>
</ul>

<img src="http://feeds.feedburner.com/~r/undolog/~4/BwPiFF4SHLw" height="1" width="1"/>]]></content:encoded><description>Gli stati UIControlStateSelected o UIControlStateHighlighted non funzionano quando un UIButton è impostato in modalità UIButtonTypeCustom! O meglio, non funzionano come dovrebbero (perchè riservati agli altri tipi di bottone), ad esempio per creare un bottone a due stati: toggle appunto. Se abbiamo creato due immagini (stato1.png e stato2.png) per il nostro bottone, possiamo procedere in questo [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.undolog.com/2009/12/04/apple-iphone-creare-un-custom-toggle-button/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://www.undolog.com/2009/12/04/apple-iphone-creare-un-custom-toggle-button/</feedburner:origLink></item><item><title>Very short snippet: streaming mp3 file su Apple iPhone</title><link>http://feedproxy.google.com/~r/undolog/~3/-xO7jzoK0d4/</link><category>Mobile</category><category>Objective-C</category><category>Sviluppo</category><category>iPhone</category><category>Apple</category><category>Apple iPhone</category><category>AVAudioPlayer</category><category>mp3</category><category>NSData</category><category>NSURLConnection</category><category>NSURLRequest</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Giovambattista Fazioli</dc:creator><pubDate>Tue, 01 Dec 2009 13:12:47 PST</pubDate><guid isPermaLink="false">http://www.undolog.com/?p=2722</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/T-uaboT8FQe8QE_0H3lzh75D87c/0/da"><img src="http://feedads.g.doubleclick.net/~a/T-uaboT8FQe8QE_0H3lzh75D87c/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/T-uaboT8FQe8QE_0H3lzh75D87c/1/da"><img src="http://feedads.g.doubleclick.net/~a/T-uaboT8FQe8QE_0H3lzh75D87c/1/di" border="0" ismap="true"></img></a></p><p>Un'alternativa davvero semplice per eseguire uno <strong>streaming di un file mp3</strong> su Apple iPhone potrebbe essere:</p>
<div class="igBar"><span id="lobjc-100"><a href="#" onclick="javascript:showCodeTxt('objc-100'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-100">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// Utilizzare AVFoundation Framework e nell'header file (.h) aggiungere</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// #import &lt;AVFoundation/AVFoundation.h&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// Nell'implementazione </span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// inserite l'url del file mp3</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span> soundFilePath <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;http://www.server.com/test.mp3&quot;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span style="color: #400080;">NSURL</span></a> <span style="color: #002200;">*</span> fileURL <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span style="color: #400080;">NSURL</span></a> URLWithString<span style="color: #002200;">:</span>soundFilePath<span style="color: #002200;">&#93;</span>;&nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLRequest_Class/"><span style="color: #400080;">NSURLRequest</span></a> <span style="color: #002200;">*</span> request <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLRequest_Class/"><span style="color: #400080;">NSURLRequest</span></a> requestWithURL<span style="color: #002200;">:</span>fileURL<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSData_Class/"><span style="color: #400080;">NSData</span></a> <span style="color: #002200;">*</span>dataRaw <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/"><span style="color: #400080;">NSURLConnection</span></a> sendSynchronousRequest<span style="color: #002200;">:</span>request returningResponse<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> error<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">AVAudioPlayer <span style="color: #002200;">*</span> audioPlayer <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>AVAudioPlayer alloc<span style="color: #002200;">&#93;</span> initWithData<span style="color: #002200;">:</span>dataRaw error<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span>audioPlayer play<span style="color: #002200;">&#93;</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p>
Ora, non direttamente correlato a questo "snippet", guardate come è facile con la (tanto odiata) sintassi a parentesi quadre di Objective-c ridurre tutto ad una sola riga:</p>
<div class="igBar"><span id="lobjc-101"><a href="#" onclick="javascript:showCodeTxt('objc-101'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-101">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">AVAudioPlayer <span style="color: #002200;">*</span> audioPlayer <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>AVAudioPlayer alloc<span style="color: #002200;">&#93;</span> initWithData<span style="color: #002200;">:</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/"><span style="color: #400080;">NSURLConnection</span></a> sendSynchronousRequest<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLRequest_Class/"><span style="color: #400080;">NSURLRequest</span></a> requestWithURL<span style="color: #002200;">:</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span style="color: #400080;">NSURL</span></a> URLWithString<span style="color: #002200;">:</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;http://www.server.com/test.mp3&quot;</span> <span style="color: #002200;">&#93;</span> <span style="color: #002200;">&#93;</span> returningResponse<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> error<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span> error<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span>audioPlayer play<span style="color: #002200;">&#93;</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p>
Indentando il codice un po' meglio si ha:</p>
<div class="igBar"><span id="lobjc-102"><a href="#" onclick="javascript:showCodeTxt('objc-102'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-102">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">AVAudioPlayer <span style="color: #002200;">*</span> audioPlayer <span style="color: #002200;">=</span> </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #002200;">&#91;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>AVAudioPlayer alloc<span style="color: #002200;">&#93;</span> </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; initWithData<span style="color: #002200;">:</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/"><span style="color: #400080;">NSURLConnection</span></a> </div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sendSynchronousRequest<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLRequest_Class/"><span style="color: #400080;">NSURLRequest</span></a> </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; requestWithURL<span style="color: #002200;">:</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span style="color: #400080;">NSURL</span></a> URLWithString<span style="color: #002200;">:</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;http://www.server.com/test.mp3&quot;</span> <span style="color: #002200;">&#93;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#93;</span> </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; returningResponse<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> error<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span>audioPlayer play<span style="color: #002200;">&#93;</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p>
Questione di gusti, ovviamente...</p>




	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F01%2Fvery-short-snippet-streaming-mp3-file-su-apple-iphone%2F&amp;title=Very%20short%20snippet%3A%20streaming%20mp3%20file%20su%20Apple%20iPhone&amp;bodytext=Un%27alternativa%20davvero%20semplice%20per%20eseguire%20uno%20streaming%20di%20un%20file%20mp3%20su%20Apple%20iPhone%20potrebbe%20essere%3A%0D%0A%5Bobjc%5D%0D%0A%2F%2F%20Utilizzare%20AVFoundation%20Framework%20e%20nell%27header%20file%20%28.h%29%20aggiungere%0D%0A%2F%2F%20%23import%20%0D%0A%0D%0A%2F%2F%20Nell%27implementazione%20%0D%0A%2F%2F%20inserite%20l%27url%20de" title="Digg"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F01%2Fvery-short-snippet-streaming-mp3-file-su-apple-iphone%2F&amp;title=Very%20short%20snippet%3A%20streaming%20mp3%20file%20su%20Apple%20iPhone&amp;notes=Un%27alternativa%20davvero%20semplice%20per%20eseguire%20uno%20streaming%20di%20un%20file%20mp3%20su%20Apple%20iPhone%20potrebbe%20essere%3A%0D%0A%5Bobjc%5D%0D%0A%2F%2F%20Utilizzare%20AVFoundation%20Framework%20e%20nell%27header%20file%20%28.h%29%20aggiungere%0D%0A%2F%2F%20%23import%20%0D%0A%0D%0A%2F%2F%20Nell%27implementazione%20%0D%0A%2F%2F%20inserite%20l%27url%20de" title="del.icio.us"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F01%2Fvery-short-snippet-streaming-mp3-file-su-apple-iphone%2F" title="Technorati"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F01%2Fvery-short-snippet-streaming-mp3-file-su-apple-iphone%2F&amp;t=Very%20short%20snippet%3A%20streaming%20mp3%20file%20su%20Apple%20iPhone" title="Facebook"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F01%2Fvery-short-snippet-streaming-mp3-file-su-apple-iphone%2F&amp;title=Very%20short%20snippet%3A%20streaming%20mp3%20file%20su%20Apple%20iPhone&amp;annotation=Un%27alternativa%20davvero%20semplice%20per%20eseguire%20uno%20streaming%20di%20un%20file%20mp3%20su%20Apple%20iPhone%20potrebbe%20essere%3A%0D%0A%5Bobjc%5D%0D%0A%2F%2F%20Utilizzare%20AVFoundation%20Framework%20e%20nell%27header%20file%20%28.h%29%20aggiungere%0D%0A%2F%2F%20%23import%20%0D%0A%0D%0A%2F%2F%20Nell%27implementazione%20%0D%0A%2F%2F%20inserite%20l%27url%20de" title="Google Bookmarks"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Very%20short%20snippet%3A%20streaming%20mp3%20file%20su%20Apple%20iPhone%20-%20http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F01%2Fvery-short-snippet-streaming-mp3-file-su-apple-iphone%2F" title="Twitter"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://barrapunto.com/submit.pl?subj=Very%20short%20snippet%3A%20streaming%20mp3%20file%20su%20Apple%20iPhone&amp;story=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F01%2Fvery-short-snippet-streaming-mp3-file-su-apple-iphone%2F" title="BarraPunto"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://current.com/clipper.htm?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F01%2Fvery-short-snippet-streaming-mp3-file-su-apple-iphone%2F&amp;title=Very%20short%20snippet%3A%20streaming%20mp3%20file%20su%20Apple%20iPhone" title="Current"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/current.png" title="Current" alt="Current" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=Very%20short%20snippet%3A%20streaming%20mp3%20file%20su%20Apple%20iPhone&amp;body=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F01%2Fvery-short-snippet-streaming-mp3-file-su-apple-iphone%2F" title="email"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Very%20short%20snippet%3A%20streaming%20mp3%20file%20su%20Apple%20iPhone&amp;link=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F01%2Fvery-short-snippet-streaming-mp3-file-su-apple-iphone%2F" title="FriendFeed"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://laaik.it/NewStoryCompact.aspx?uri=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F01%2Fvery-short-snippet-streaming-mp3-file-su-apple-iphone%2F&amp;headline=Very%20short%20snippet%3A%20streaming%20mp3%20file%20su%20Apple%20iPhone&amp;cat=5e082fcc-8a3b-47e2-acec-fdf64ff19d12" title="laaik.it"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/laaikit.png" title="laaik.it" alt="laaik.it" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F01%2Fvery-short-snippet-streaming-mp3-file-su-apple-iphone%2F&amp;title=Very%20short%20snippet%3A%20streaming%20mp3%20file%20su%20Apple%20iPhone&amp;source=Undolog.com+Research+%26amp%3B+Development++Blog&amp;summary=Un%27alternativa%20davvero%20semplice%20per%20eseguire%20uno%20streaming%20di%20un%20file%20mp3%20su%20Apple%20iPhone%20potrebbe%20essere%3A%0D%0A%5Bobjc%5D%0D%0A%2F%2F%20Utilizzare%20AVFoundation%20Framework%20e%20nell%27header%20file%20%28.h%29%20aggiungere%0D%0A%2F%2F%20%23import%20%0D%0A%0D%0A%2F%2F%20Nell%27implementazione%20%0D%0A%2F%2F%20inserite%20l%27url%20de" title="LinkedIn"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F01%2Fvery-short-snippet-streaming-mp3-file-su-apple-iphone%2F&amp;title=Very%20short%20snippet%3A%20streaming%20mp3%20file%20su%20Apple%20iPhone" title="Live"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F01%2Fvery-short-snippet-streaming-mp3-file-su-apple-iphone%2F&amp;t=Very%20short%20snippet%3A%20streaming%20mp3%20file%20su%20Apple%20iPhone" title="MySpace"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Very%20short%20snippet%3A%20streaming%20mp3%20file%20su%20Apple%20iPhone&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F01%2Fvery-short-snippet-streaming-mp3-file-su-apple-iphone%2F" title="Netvibes"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F01%2Fvery-short-snippet-streaming-mp3-file-su-apple-iphone%2F&amp;partner=sociable" title="Print"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.undolog.com/feed/" title="RSS"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://segnalo.alice.it/post.html.php?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F01%2Fvery-short-snippet-streaming-mp3-file-su-apple-iphone%2F&amp;title=Very%20short%20snippet%3A%20streaming%20mp3%20file%20su%20Apple%20iPhone" title="Segnalo"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/segnalo.png" title="Segnalo" alt="Segnalo" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F01%2Fvery-short-snippet-streaming-mp3-file-su-apple-iphone%2F&amp;title=Very%20short%20snippet%3A%20streaming%20mp3%20file%20su%20Apple%20iPhone" title="StumbleUpon"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.wikio.it/vote?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F12%2F01%2Fvery-short-snippet-streaming-mp3-file-su-apple-iphone%2F" title="Wikio IT"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/wikio.png" title="Wikio IT" alt="Wikio IT" class="sociable-hovers" /></a>


<br/><br/>
	Tags: <a href="http://www.undolog.com/tag/apple/" title="Apple" rel="tag">Apple</a>, <a href="http://www.undolog.com/tag/apple-iphone/" title="Apple iPhone" rel="tag">Apple iPhone</a>, <a href="http://www.undolog.com/tag/avaudioplayer/" title="AVAudioPlayer" rel="tag">AVAudioPlayer</a>, <a href="http://www.undolog.com/tag/iphone/" title="iPhone" rel="tag">iPhone</a>, <a href="http://www.undolog.com/category/sviluppo/iphone-sviluppo/" title="iPhone" rel="tag">iPhone</a>, <a href="http://www.undolog.com/category/mobile/" title="Mobile" rel="tag">Mobile</a>, <a href="http://www.undolog.com/tag/mp3/" title="mp3" rel="tag">mp3</a>, <a href="http://www.undolog.com/tag/nsdata/" title="NSData" rel="tag">NSData</a>, <a href="http://www.undolog.com/tag/nsurlconnection/" title="NSURLConnection" rel="tag">NSURLConnection</a>, <a href="http://www.undolog.com/tag/nsurlrequest/" title="NSURLRequest" rel="tag">NSURLRequest</a>, <a href="http://www.undolog.com/category/sviluppo/iphone-sviluppo/objective-c-sviluppo/" title="Objective-C" rel="tag">Objective-C</a>, <a href="http://www.undolog.com/category/sviluppo/" title="Sviluppo" rel="tag">Sviluppo</a><br />

	<h4>Post correlati</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.undolog.com/2009/12/04/apple-iphone-creare-un-custom-toggle-button/" title="Apple iPhone: creare un custom toggle button (4 dicembre, 2009)">Apple iPhone: creare un custom toggle button</a> (0)</li>
	<li><a href="http://www.undolog.com/2009/07/10/xcode-organizzare-il-codice-con-la-direttiva-pragma-mark/" title="XCode: organizzare il codice con la direttiva #pragma mark (10 luglio, 2009)">XCode: organizzare il codice con la direttiva #pragma mark</a> (0)</li>
	<li><a href="http://www.undolog.com/2009/07/20/xcode-consigli-sul-debugging-preferences/" title="XCode: consigli sul Debugging Preferences (20 luglio, 2009)">XCode: consigli sul Debugging Preferences</a> (0)</li>
	<li><a href="http://www.undolog.com/2009/07/23/xcode-shortcut/" title="Xcode shortcut (23 luglio, 2009)">Xcode shortcut</a> (0)</li>
	<li><a href="http://www.undolog.com/2009/06/16/very-short-trick-fermare-nstimer/" title="Very short trick: fermare NSTimer (16 giugno, 2009)">Very short trick: fermare NSTimer</a> (0)</li>
</ul>

<img src="http://feeds.feedburner.com/~r/undolog/~4/-xO7jzoK0d4" height="1" width="1"/>]]></content:encoded><description>Un'alternativa davvero semplice per eseguire uno streaming di un file mp3 su Apple iPhone potrebbe essere:
PLAIN TEXT
Objective-C:




// Utilizzare AVFoundation Framework e nell'header file (.h) aggiungere


// #import &amp;#60;AVFoundation/AVFoundation.h&amp;#62;


&amp;#160;


// Nell'implementazione 


// inserite l'url del file mp3


NSString * soundFilePath = @&amp;#34;http://www.server.com/test.mp3&amp;#34;;


&amp;#160;


NSURL * fileURL = &amp;#91;NSURL URLWithString:soundFilePath&amp;#93;;&amp;#160; 


NSURLRequest * request = &amp;#91;NSURLRequest requestWithURL:fileURL&amp;#93;;


NSData *dataRaw = &amp;#91;NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil&amp;#93;;


&amp;#160;


AVAudioPlayer [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.undolog.com/2009/12/01/very-short-snippet-streaming-mp3-file-su-apple-iphone/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://www.undolog.com/2009/12/01/very-short-snippet-streaming-mp3-file-su-apple-iphone/</feedburner:origLink></item><item><title>Very short snippet: Wordpress, lista categorie con checkbox</title><link>http://feedproxy.google.com/~r/undolog/~3/Z4hJd5PjjD8/</link><category>Internet</category><category>PHP</category><category>Sviluppo</category><category>WordPress</category><category>Categorie</category><category>functions.php</category><category>Plugins</category><category>Snipp</category><category>Widget</category><category>WP-Bannerize</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Giovambattista Fazioli</dc:creator><pubDate>Mon, 30 Nov 2009 05:12:05 PST</pubDate><guid isPermaLink="false">http://www.undolog.com/?p=2711</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/H8anp3Zq3PivpWOF4qFEfheH5KU/0/da"><img src="http://feedads.g.doubleclick.net/~a/H8anp3Zq3PivpWOF4qFEfheH5KU/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/H8anp3Zq3PivpWOF4qFEfheH5KU/1/da"><img src="http://feedads.g.doubleclick.net/~a/H8anp3Zq3PivpWOF4qFEfheH5KU/1/di" border="0" ismap="true"></img></a></p><p>Nei giorni scorsi ho rilasciato un nuova major release (la 2.3.0) del plugin Wordpress <a target="_blank" href="http://wordpress.org/extend/plugins/wp-bannerize/">WP Bannerize</a>, ultima per quest'anno. Oltre ad aver introdotto l'uso dei <strong>Widget</strong> (su cui spero di riuscire a scrivere qualcosa prossimamente) o "finalmente" permesso di filtrare i banner anche per <strong>categoria</strong>.<br />
Nella sezione Widget mi sono trovato nella necessità di visualizzare le categorie del blog in modo da poterle selezionare tramite un controllo checkbox! Inoltre, dovevo visualizzarle "indentate" nel rispetto della gerarchia padre/figlio. Dopo aver dato uno sguardo (ammetto veloce) alle funzioni di Wordpress, mi è sembrato che non ci fosse nulla di già fatto disponibile e documentato!</p>
<blockquote><p><strong>Nota</strong>: in realtà, quando inseriamo un nuovo post nel backend di Wordress, la pagina propone proprio una lista delle categorie indentata con tanto di checkbox! Tuttavia, non volendo eseguire nessun reverse engineering per recuperare la funzione (lo ammetto... l'ho fatto e l'ho anche trovata, vedi <code>wp_category_checklist()</code> nella cartella <code>wp-admin</code>, solo che queste sono funzioni interne, quindi meglio evitare di usarle), ho optato per scriverne una mia personale</p></blockquote>
<p>Così ho scritto una funzione personale che visualizza le categorie di un Blog in un lista indentata aggiungendo un controllo checkbox. Questa funzione può essere inserita in <code>functions.php</code>. La funzione, in realtà, è composta da due funzioni: quella principale e quella di servizio utilizzata per "iterare" in modo ricorsivo.<br />
Nella versione che presento io (Wordpress usa in questi casi un suo oggetto - o meglio una sua classe - <strong><code>Walker</code></strong>) non ho usato le <a target="_blank" href="http://en.wikipedia.org/wiki/Nested_function">nested function</a>, in quanto davano qualche problema di campatibilità con la struttura dei Widget Wordpress, ma voi potete riadattarla eventualmente per altri scopi.</p>
<div class="igBar"><span id="lphp-104"><a href="#" onclick="javascript:showCodeTxt('php-104'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-104">
<div class="php" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009933; font-style: italic;">/**</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009933; font-style: italic;">&nbsp;* Restituisce una lista (UL/LI) delle categorie</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009933; font-style: italic;">&nbsp;* @params $selected_cats &nbsp; &nbsp; Array delle categorie selezionate</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009933; font-style: italic;">&nbsp;* </span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009933; font-style: italic;">&nbsp;* @return HTML</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009933; font-style: italic;">&nbsp;*/</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">function</span> get_categories_checkboxes<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$selected_cats</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000088;">$all_categories</span> <span style="color: #339933;">=</span> get_categories<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000088;">$o</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;ul style=&quot;margin-left:12px&quot;&gt;'</span><span style="color: #339933;">;</span> &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$all_categories</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$cat</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cat</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">parent</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;0&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$o</span> <span style="color: #339933;">.=</span> __show_category<span style="color: #009900;">&#40;</span><span style="color: #000088;">$cat</span><span style="color: #339933;">,</span> <span style="color: #000088;">$selected_cats</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$o</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/ul&gt;'</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">function</span> __show_category<span style="color: #009900;">&#40;</span><span style="color: #000088;">$cat_object</span><span style="color: #339933;">,</span> <span style="color: #000088;">$selected_cats</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000088;">$checked</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/is_null"><span style="color: #990000;">is_null</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$selected_cats</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <a href="http://www.php.net/is_array"><span style="color: #990000;">is_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$selected_cats</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$checked</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/in_array"><span style="color: #990000;">in_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cat_object</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cat_ID</span><span style="color: #339933;">,</span> <span style="color: #000088;">$selected_cats</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">'checked=&quot;checked&quot;'</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000088;">$ou</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;li&gt;&lt;label&gt;&lt;input '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$checked</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">' type=&quot;checkbox&quot; name=&quot;cats[]&quot; value=&quot;'</span><span style="color: #339933;">.</span> <span style="color: #000088;">$cat_object</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cat_ID</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt; '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$cat_object</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cat_name</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/label&gt;'</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000088;">$childs</span> <span style="color: #339933;">=</span> get_categories<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'parent='</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$cat_object</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cat_ID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$childs</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$cat</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$ou</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;ul style=&quot;margin-left:12px&quot;&gt;'</span> <span style="color: #339933;">.</span> __show_category<span style="color: #009900;">&#40;</span><span style="color: #000088;">$cat</span><span style="color: #339933;">,</span> <span style="color: #000088;">$selected_cats</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/ul&gt;'</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000088;">$ou</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;/li&gt;'</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$ou</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>




	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F30%2Fvery-short-snippet-wordpress-lista-categorie-con-checkbox%2F&amp;title=Very%20short%20snippet%3A%20Wordpress%2C%20lista%20categorie%20con%20checkbox&amp;bodytext=Nei%20giorni%20scorsi%20ho%20rilasciato%20un%20nuova%20major%20release%20%28la%202.3.0%29%20del%20plugin%20Wordpress%20WP%20Bannerize%2C%20ultima%20per%20quest%27anno.%20Oltre%20ad%20aver%20introdotto%20l%27uso%20dei%20Widget%20%28su%20cui%20spero%20di%20riuscire%20a%20scrivere%20qualcosa%20prossimamente%29%20o%20%22finalmente%22%20permesso" title="Digg"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F30%2Fvery-short-snippet-wordpress-lista-categorie-con-checkbox%2F&amp;title=Very%20short%20snippet%3A%20Wordpress%2C%20lista%20categorie%20con%20checkbox&amp;notes=Nei%20giorni%20scorsi%20ho%20rilasciato%20un%20nuova%20major%20release%20%28la%202.3.0%29%20del%20plugin%20Wordpress%20WP%20Bannerize%2C%20ultima%20per%20quest%27anno.%20Oltre%20ad%20aver%20introdotto%20l%27uso%20dei%20Widget%20%28su%20cui%20spero%20di%20riuscire%20a%20scrivere%20qualcosa%20prossimamente%29%20o%20%22finalmente%22%20permesso" title="del.icio.us"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F30%2Fvery-short-snippet-wordpress-lista-categorie-con-checkbox%2F" title="Technorati"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F30%2Fvery-short-snippet-wordpress-lista-categorie-con-checkbox%2F&amp;t=Very%20short%20snippet%3A%20Wordpress%2C%20lista%20categorie%20con%20checkbox" title="Facebook"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F30%2Fvery-short-snippet-wordpress-lista-categorie-con-checkbox%2F&amp;title=Very%20short%20snippet%3A%20Wordpress%2C%20lista%20categorie%20con%20checkbox&amp;annotation=Nei%20giorni%20scorsi%20ho%20rilasciato%20un%20nuova%20major%20release%20%28la%202.3.0%29%20del%20plugin%20Wordpress%20WP%20Bannerize%2C%20ultima%20per%20quest%27anno.%20Oltre%20ad%20aver%20introdotto%20l%27uso%20dei%20Widget%20%28su%20cui%20spero%20di%20riuscire%20a%20scrivere%20qualcosa%20prossimamente%29%20o%20%22finalmente%22%20permesso" title="Google Bookmarks"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Very%20short%20snippet%3A%20Wordpress%2C%20lista%20categorie%20con%20checkbox%20-%20http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F30%2Fvery-short-snippet-wordpress-lista-categorie-con-checkbox%2F" title="Twitter"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://barrapunto.com/submit.pl?subj=Very%20short%20snippet%3A%20Wordpress%2C%20lista%20categorie%20con%20checkbox&amp;story=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F30%2Fvery-short-snippet-wordpress-lista-categorie-con-checkbox%2F" title="BarraPunto"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://current.com/clipper.htm?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F30%2Fvery-short-snippet-wordpress-lista-categorie-con-checkbox%2F&amp;title=Very%20short%20snippet%3A%20Wordpress%2C%20lista%20categorie%20con%20checkbox" title="Current"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/current.png" title="Current" alt="Current" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=Very%20short%20snippet%3A%20Wordpress%2C%20lista%20categorie%20con%20checkbox&amp;body=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F30%2Fvery-short-snippet-wordpress-lista-categorie-con-checkbox%2F" title="email"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Very%20short%20snippet%3A%20Wordpress%2C%20lista%20categorie%20con%20checkbox&amp;link=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F30%2Fvery-short-snippet-wordpress-lista-categorie-con-checkbox%2F" title="FriendFeed"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://laaik.it/NewStoryCompact.aspx?uri=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F30%2Fvery-short-snippet-wordpress-lista-categorie-con-checkbox%2F&amp;headline=Very%20short%20snippet%3A%20Wordpress%2C%20lista%20categorie%20con%20checkbox&amp;cat=5e082fcc-8a3b-47e2-acec-fdf64ff19d12" title="laaik.it"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/laaikit.png" title="laaik.it" alt="laaik.it" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F30%2Fvery-short-snippet-wordpress-lista-categorie-con-checkbox%2F&amp;title=Very%20short%20snippet%3A%20Wordpress%2C%20lista%20categorie%20con%20checkbox&amp;source=Undolog.com+Research+%26amp%3B+Development++Blog&amp;summary=Nei%20giorni%20scorsi%20ho%20rilasciato%20un%20nuova%20major%20release%20%28la%202.3.0%29%20del%20plugin%20Wordpress%20WP%20Bannerize%2C%20ultima%20per%20quest%27anno.%20Oltre%20ad%20aver%20introdotto%20l%27uso%20dei%20Widget%20%28su%20cui%20spero%20di%20riuscire%20a%20scrivere%20qualcosa%20prossimamente%29%20o%20%22finalmente%22%20permesso" title="LinkedIn"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F30%2Fvery-short-snippet-wordpress-lista-categorie-con-checkbox%2F&amp;title=Very%20short%20snippet%3A%20Wordpress%2C%20lista%20categorie%20con%20checkbox" title="Live"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F30%2Fvery-short-snippet-wordpress-lista-categorie-con-checkbox%2F&amp;t=Very%20short%20snippet%3A%20Wordpress%2C%20lista%20categorie%20con%20checkbox" title="MySpace"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Very%20short%20snippet%3A%20Wordpress%2C%20lista%20categorie%20con%20checkbox&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F30%2Fvery-short-snippet-wordpress-lista-categorie-con-checkbox%2F" title="Netvibes"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F30%2Fvery-short-snippet-wordpress-lista-categorie-con-checkbox%2F&amp;partner=sociable" title="Print"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.undolog.com/feed/" title="RSS"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://segnalo.alice.it/post.html.php?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F30%2Fvery-short-snippet-wordpress-lista-categorie-con-checkbox%2F&amp;title=Very%20short%20snippet%3A%20Wordpress%2C%20lista%20categorie%20con%20checkbox" title="Segnalo"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/segnalo.png" title="Segnalo" alt="Segnalo" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F30%2Fvery-short-snippet-wordpress-lista-categorie-con-checkbox%2F&amp;title=Very%20short%20snippet%3A%20Wordpress%2C%20lista%20categorie%20con%20checkbox" title="StumbleUpon"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.wikio.it/vote?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F30%2Fvery-short-snippet-wordpress-lista-categorie-con-checkbox%2F" title="Wikio IT"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/wikio.png" title="Wikio IT" alt="Wikio IT" class="sociable-hovers" /></a>


<br/><br/>
	Tags: <a href="http://www.undolog.com/tag/categorie/" title="Categorie" rel="tag">Categorie</a>, <a href="http://www.undolog.com/tag/functionsphp/" title="functions.php" rel="tag">functions.php</a>, <a href="http://www.undolog.com/category/sviluppo/internet/" title="Internet" rel="tag">Internet</a>, <a href="http://www.undolog.com/category/sviluppo/internet/php/" title="PHP" rel="tag">PHP</a>, <a href="http://www.undolog.com/tag/php/" title="PHP" rel="tag">PHP</a>, <a href="http://www.undolog.com/tag/plugins/" title="Plugins" rel="tag">Plugins</a>, <a href="http://www.undolog.com/tag/snipp/" title="Snipp" rel="tag">Snipp</a>, <a href="http://www.undolog.com/category/sviluppo/" title="Sviluppo" rel="tag">Sviluppo</a>, <a href="http://www.undolog.com/tag/widget/" title="Widget" rel="tag">Widget</a>, <a href="http://www.undolog.com/category/sviluppo/internet/wordpress/" title="WordPress" rel="tag">WordPress</a>, <a href="http://www.undolog.com/tag/wordpress/" title="WordPress" rel="tag">WordPress</a>, <a href="http://www.undolog.com/tag/wp-bannerize/" title="WP-Bannerize" rel="tag">WP-Bannerize</a><br />

	<h4>Post correlati</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.undolog.com/2008/11/19/very-short-snippet-wordpress-separare-le-categorie-in-due-colonne/" title="Very short snippet: Wordpress, separare le categorie in due colonne (19 novembre, 2008)">Very short snippet: Wordpress, separare le categorie in due colonne</a> (1)</li>
	<li><a href="http://www.undolog.com/2009/06/05/very-short-snippet-visualizzare-una-lista-di-post-per-categoria-o-tag/" title="Very short snippet: visualizzare una lista di post per categoria o tag (5 giugno, 2009)">Very short snippet: visualizzare una lista di post per categoria o tag</a> (2)</li>
	<li><a href="http://www.undolog.com/2009/03/20/very-short-snippet-come-recuperare-la-categoria-padre-in-wordpress/" title="Very short snippet: come recuperare la categoria padre in Wordpress (20 marzo, 2009)">Very short snippet: come recuperare la categoria padre in Wordpress</a> (2)</li>
	<li><a href="http://www.undolog.com/2009/07/03/wordpress-usare-gli-shortcodes/" title="Wordpress: usare gli shortcodes (3 luglio, 2009)">Wordpress: usare gli shortcodes</a> (5)</li>
	<li><a href="http://www.undolog.com/2008/11/01/wordpress-rimuovere-i-menu-dellamministrazione/" title="Wordpress: rimuovere i menu dell&#8217;amministrazione (1 novembre, 2008)">Wordpress: rimuovere i menu dell&#8217;amministrazione</a> (12)</li>
</ul>

<img src="http://feeds.feedburner.com/~r/undolog/~4/Z4hJd5PjjD8" height="1" width="1"/>]]></content:encoded><description>Nei giorni scorsi ho rilasciato un nuova major release (la 2.3.0) del plugin Wordpress WP Bannerize, ultima per quest'anno. Oltre ad aver introdotto l'uso dei Widget (su cui spero di riuscire a scrivere qualcosa prossimamente) o "finalmente" permesso di filtrare i banner anche per categoria.
Nella sezione Widget mi sono trovato nella necessità di visualizzare le [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.undolog.com/2009/11/30/very-short-snippet-wordpress-lista-categorie-con-checkbox/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">1</slash:comments><feedburner:origLink>http://www.undolog.com/2009/11/30/very-short-snippet-wordpress-lista-categorie-con-checkbox/</feedburner:origLink></item><item><title>Mad Ideas: il primo User Generated Ideas</title><link>http://feedproxy.google.com/~r/undolog/~3/ho20kWBsHXY/</link><category>Eventi &amp; Iniziative</category><category>Featured</category><category>Tecnologia</category><category>Apple</category><category>Bagnetti</category><category>Liquida</category><category>MadIdeas</category><category>Saidmade</category><category>UGI</category><category>User Generated Ideas</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Giovambattista Fazioli</dc:creator><pubDate>Tue, 24 Nov 2009 16:27:02 PST</pubDate><guid isPermaLink="false">http://www.undolog.com/?p=2689</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/ajjr_ty1yp8eF-Ay4yZEblGmOzQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/ajjr_ty1yp8eF-Ay4yZEblGmOzQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/ajjr_ty1yp8eF-Ay4yZEblGmOzQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/ajjr_ty1yp8eF-Ay4yZEblGmOzQ/1/di" border="0" ismap="true"></img></a></p><p>Oggi, 25 novembre 2009, nasce ufficialmente <a target="_blank" href="http://www.mad-ideas.it">Mad Ideas</a>, la prima fabbrica delle <strong>idee generate dagli utenti</strong> (UGI User Generated Ideas).</p>
<h4>Cos'è Mad Ideas?</h4>
<p>E' un progetto ideato e realizzato da <a target="_blank" href="http://www.saidmade.com">Saidmade</a> (quindi anche dal sottoscritto) a sfondo sociale, orientato in particolare al concetto di cambiamento. L'obiettivo è quello di raccogliere le idee e progetti, proposti da voi "internauti" e - insieme - trasformarli in realtà.</p>
<h4>Cosa si vince?</h4>
<p>Oltre alla realizzazione dell'idea, per rendere l'iniziativa più avvincente, abbiamo deciso di mettere in palio alcuni premi:</p>
<ul>
<li>Primo classificato: <strong>€ 2000,00</strong></li>
<li>Secondo classificato: <strong>€ 1000,00</strong></li>
<li>Terzo classificato: <strong>Apple iPhone 3GS 32 Gb</strong></li>
</ul>
<p>Inoltre, ogni mese il progetto migliore si aggiudicherà un <strong>Apple iPod Nano da 8Gb</strong>!</p>
<p class="center"><img src="http://www.undolog.com/wp-content/uploads/2009/11/iphone-ipod.jpg" alt="iphone-ipod" title="iphone-ipod" width="300" height="114"/></p>
<h4>Inviate le vostre idee</h4>
<p>I progetti e le idee potranno essere inviati da sabato <strong>5 dicembre 2009</strong>, per 12 mesi, direttamente dal sito <a target="_blank" href="http://www.mad-ideas.it">www.mad-ideas.it</a>. Tutti, sia <strong>privati</strong> che <strong>associazioni senza fini di lucro</strong>, potranno proporre un progetto o un'idea (preferibilmente folle!) che rientri in una delle categorie indicate nel <a target="_blank" href="http://www.mad-ideas.it/regolamento/">regolamento</a> dell'iniziativa.<br />
Seguendo il concetto di <strong>User Generated Ideas</strong>, scopo di tali progetti dovrà essere quello di offrire strumenti alternativi che, partendo dall'ispirazione del singolo individuo, divengano nuovi modelli di vita per l'intera comunità.<br />
In particolare, gli ambiti di intervento saranno:</p>
<ul>
<li>Ambiente</li>
<li>Community</li>
<li>Cultura</li>
</ul>
<p>Un'apposita redazione formata da esperti del settore vaglierà le proposte più interessanti ed ogni mese pubblicherà sul sito l'idea migliore che sarà premiata con un <strong>Apple iPod Touch da 8GB</strong>; al termine dell'iniziativa, previsto per il <strong>5 dicembre 2010</strong>, i <strong>tre progetti</strong> più significativi dei dodici riceveranno i premi sopra indicati, mentre il <a target="_blank" href="http://www.saidmade.com/chi-siamo/saidmade-team/">team di Saidmade</a> metterà a disposizione le proprie risorse per realizzare l'idea finalista. Ideale e reale.</p>
<h4>Nel frattempo...</h4>
<p><img src="http://www.undolog.com/wp-content/uploads/2009/11/screen-shot-1.jpg" alt="MadIdeas" title="MadIdeas" width="94" height="199" style="float:left;margin:0 12px 0 0" />Potete iniziare ad inviare la vostra <a target="_blank" href="http://www.mad-ideas.it/photobulb/">PhotoBulb</a>, iniziativa ludica pensata per stimolare la fantasia e raccogliere le foto più divertenti, curiose e geniali che, previa approvazione, saranno inserito sul sito Web di <a target="_blank" href="http://www.mad-ideas.it">Mad Ideas</a>.<br />
Per inviare la vostra <a target="_blank" href="http://www.mad-ideas.it/photobulb/">PhotoBulb</a>, potete utilizzare <a href="http://itunes.apple.com/it/app/mad-ideas/id338660872?mt=8">l'applicazione per Apple iPhone Mad Ideas</a> che abbiamo scritto appositamente per l'occasione e già disponibile su Appstore. L'applicazione, oltre a permettere di scattare ed inviare la vostro foto, consente di leggere le ultime notizie sul progetto Mad Ideas direttamente da iPhone.<br />
In alternativa, per chi ancora non possiede un "melafonino", ho realizzato un <a target="_blank" href="http://www.mad-ideas.it/scatta-la-tua-photobulb/">simulatore in Adobe Flash</a> che riproduce, pressapoco, le stesse funzionalità di scatto ed invia <img src='http://www.undolog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p class="center"><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/pK7ibw7iOdA&#038;color1=0x234900&#038;color2=0x4e9e00&#038;hl=it_IT&#038;feature=player_embedded&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/pK7ibw7iOdA&#038;color1=0x234900&#038;color2=0x4e9e00&#038;hl=it_IT&#038;feature=player_embedded&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="425" height="344"></embed></object></p>
<h4>Un grazie...</h4>
<p>Il progetto <a target="_blank" href="http://www.mad-ideas.it">Mad Ideas</a> è stato possibile anche grazie agli <a target="_blank" href="http://www.mad-ideas.it/sponsors/">sponsor</a> che hanno sostenuto l'iniziativa (come <a target="_blank" href="http://www.liquida.it/">Liquida</a>, <a target="_blank" href="http://www.bagnetti.it/">Bagnetti Apple Solution Expert</a>, <a target="_blank" href="http://www.lifegate.it/">LifeGate</a> ed altri...) oltre che grazie al passaparola di numerosi blogger italiani; che trovate indicati <a target="_blank" href="http://www.mad-ideas.it/sponsors/">qui</a>.</p>
<h4>Per finire</h4>
<p>Sul sito Web di <a target="_blank" href="http://www.mad-ideas.it">Mad Ideas</a> troverete tutte le informazioni necessarie per capire, conoscere, partecipare. Potrete seguire il <a target="_blank" href="http://www.mad-ideas.it/blog/">Blog</a> e promuovere l'iniziativa con appositi <a target="_blank" href="http://www.mad-ideas.it/gadgets/">Gadgets/Widgets</a> da inserire nei vostri Blog o siti Web.<br />
Fuoco alle polveri, dunque, e in bocca al lupo a tutti i partecipanti!</p>




	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F25%2Fmad-ideas-il-primo-user-generated-ideas%2F&amp;title=Mad%20Ideas%3A%20il%20primo%20User%20Generated%20Ideas&amp;bodytext=Saidmade%20lancia%20la%20prima%20fabbrica%20delle%20idee%20generate%20dagli%20utenti%20online%3A%20in%20palio%202000%20Euro%2C%20Apple%20iPhone%2C%20Apple%20iPod%20e%20altro%20ancora..." title="Digg"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F25%2Fmad-ideas-il-primo-user-generated-ideas%2F&amp;title=Mad%20Ideas%3A%20il%20primo%20User%20Generated%20Ideas&amp;notes=Saidmade%20lancia%20la%20prima%20fabbrica%20delle%20idee%20generate%20dagli%20utenti%20online%3A%20in%20palio%202000%20Euro%2C%20Apple%20iPhone%2C%20Apple%20iPod%20e%20altro%20ancora..." title="del.icio.us"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F25%2Fmad-ideas-il-primo-user-generated-ideas%2F" title="Technorati"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F25%2Fmad-ideas-il-primo-user-generated-ideas%2F&amp;t=Mad%20Ideas%3A%20il%20primo%20User%20Generated%20Ideas" title="Facebook"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F25%2Fmad-ideas-il-primo-user-generated-ideas%2F&amp;title=Mad%20Ideas%3A%20il%20primo%20User%20Generated%20Ideas&amp;annotation=Saidmade%20lancia%20la%20prima%20fabbrica%20delle%20idee%20generate%20dagli%20utenti%20online%3A%20in%20palio%202000%20Euro%2C%20Apple%20iPhone%2C%20Apple%20iPod%20e%20altro%20ancora..." title="Google Bookmarks"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Mad%20Ideas%3A%20il%20primo%20User%20Generated%20Ideas%20-%20http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F25%2Fmad-ideas-il-primo-user-generated-ideas%2F" title="Twitter"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://barrapunto.com/submit.pl?subj=Mad%20Ideas%3A%20il%20primo%20User%20Generated%20Ideas&amp;story=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F25%2Fmad-ideas-il-primo-user-generated-ideas%2F" title="BarraPunto"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://current.com/clipper.htm?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F25%2Fmad-ideas-il-primo-user-generated-ideas%2F&amp;title=Mad%20Ideas%3A%20il%20primo%20User%20Generated%20Ideas" title="Current"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/current.png" title="Current" alt="Current" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=Mad%20Ideas%3A%20il%20primo%20User%20Generated%20Ideas&amp;body=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F25%2Fmad-ideas-il-primo-user-generated-ideas%2F" title="email"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Mad%20Ideas%3A%20il%20primo%20User%20Generated%20Ideas&amp;link=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F25%2Fmad-ideas-il-primo-user-generated-ideas%2F" title="FriendFeed"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://laaik.it/NewStoryCompact.aspx?uri=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F25%2Fmad-ideas-il-primo-user-generated-ideas%2F&amp;headline=Mad%20Ideas%3A%20il%20primo%20User%20Generated%20Ideas&amp;cat=5e082fcc-8a3b-47e2-acec-fdf64ff19d12" title="laaik.it"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/laaikit.png" title="laaik.it" alt="laaik.it" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F25%2Fmad-ideas-il-primo-user-generated-ideas%2F&amp;title=Mad%20Ideas%3A%20il%20primo%20User%20Generated%20Ideas&amp;source=Undolog.com+Research+%26amp%3B+Development++Blog&amp;summary=Saidmade%20lancia%20la%20prima%20fabbrica%20delle%20idee%20generate%20dagli%20utenti%20online%3A%20in%20palio%202000%20Euro%2C%20Apple%20iPhone%2C%20Apple%20iPod%20e%20altro%20ancora..." title="LinkedIn"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F25%2Fmad-ideas-il-primo-user-generated-ideas%2F&amp;title=Mad%20Ideas%3A%20il%20primo%20User%20Generated%20Ideas" title="Live"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F25%2Fmad-ideas-il-primo-user-generated-ideas%2F&amp;t=Mad%20Ideas%3A%20il%20primo%20User%20Generated%20Ideas" title="MySpace"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Mad%20Ideas%3A%20il%20primo%20User%20Generated%20Ideas&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F25%2Fmad-ideas-il-primo-user-generated-ideas%2F" title="Netvibes"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F25%2Fmad-ideas-il-primo-user-generated-ideas%2F&amp;partner=sociable" title="Print"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.undolog.com/feed/" title="RSS"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://segnalo.alice.it/post.html.php?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F25%2Fmad-ideas-il-primo-user-generated-ideas%2F&amp;title=Mad%20Ideas%3A%20il%20primo%20User%20Generated%20Ideas" title="Segnalo"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/segnalo.png" title="Segnalo" alt="Segnalo" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F25%2Fmad-ideas-il-primo-user-generated-ideas%2F&amp;title=Mad%20Ideas%3A%20il%20primo%20User%20Generated%20Ideas" title="StumbleUpon"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.wikio.it/vote?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F25%2Fmad-ideas-il-primo-user-generated-ideas%2F" title="Wikio IT"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/wikio.png" title="Wikio IT" alt="Wikio IT" class="sociable-hovers" /></a>


<br/><br/>
	Tags: <a href="http://www.undolog.com/tag/apple/" title="Apple" rel="tag">Apple</a>, <a href="http://www.undolog.com/tag/bagnetti/" title="Bagnetti" rel="tag">Bagnetti</a>, <a href="http://www.undolog.com/category/eventi-iniziative/" title="Eventi &amp; Iniziative" rel="tag">Eventi &amp; Iniziative</a>, <a href="http://www.undolog.com/category/featured/" title="Featured" rel="tag">Featured</a>, <a href="http://www.undolog.com/tag/liquida/" title="Liquida" rel="tag">Liquida</a>, <a href="http://www.undolog.com/tag/madideas/" title="MadIdeas" rel="tag">MadIdeas</a>, <a href="http://www.undolog.com/tag/saidmade/" title="Saidmade" rel="tag">Saidmade</a>, <a href="http://www.undolog.com/category/tecnologia/" title="Tecnologia" rel="tag">Tecnologia</a>, <a href="http://www.undolog.com/tag/ugi/" title="UGI" rel="tag">UGI</a>, <a href="http://www.undolog.com/tag/user-generated-ideas/" title="User Generated Ideas" rel="tag">User Generated Ideas</a><br />

	<h4>Post correlati</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.undolog.com/2009/06/09/the-first-disponibile-su-itunes/" title="The First: disponibile su iTunes (9 giugno, 2009)">The First: disponibile su iTunes</a> (1)</li>
	<li><a href="http://www.undolog.com/2009/07/06/apple-iphone-the-first-release-1-2/" title="Apple iPhone: The First Release 1.2 (6 luglio, 2009)">Apple iPhone: The First Release 1.2</a> (1)</li>
	<li><a href="http://www.undolog.com/2009/07/10/xcode-organizzare-il-codice-con-la-direttiva-pragma-mark/" title="XCode: organizzare il codice con la direttiva #pragma mark (10 luglio, 2009)">XCode: organizzare il codice con la direttiva #pragma mark</a> (0)</li>
	<li><a href="http://www.undolog.com/2009/07/20/xcode-consigli-sul-debugging-preferences/" title="XCode: consigli sul Debugging Preferences (20 luglio, 2009)">XCode: consigli sul Debugging Preferences</a> (0)</li>
	<li><a href="http://www.undolog.com/2009/07/23/xcode-shortcut/" title="Xcode shortcut (23 luglio, 2009)">Xcode shortcut</a> (0)</li>
</ul>

<img src="http://feeds.feedburner.com/~r/undolog/~4/ho20kWBsHXY" height="1" width="1"/>]]></content:encoded><description>Saidmade lancia la prima fabbrica delle idee generate dagli utenti online: in palio 2000 Euro, Apple iPhone, Apple iPod e altro ancora...</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.undolog.com/2009/11/25/mad-ideas-il-primo-user-generated-ideas/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://www.undolog.com/2009/11/25/mad-ideas-il-primo-user-generated-ideas/</feedburner:origLink></item><item><title>Very short snippet: Apple iPhone file system</title><link>http://feedproxy.google.com/~r/undolog/~3/cVTPjnRkkoI/</link><category>Mobile</category><category>Objective-C</category><category>Sviluppo</category><category>iPhone</category><category>Apple</category><category>Apple iPhone</category><category>NSBundle</category><category>NSDocumentDirectory</category><category>NSFileManager</category><category>NSFullUserName()</category><category>NSHomeDirectory()</category><category>NSHomeDirectoryForUser()</category><category>NSSearchPathForDirectoriesInDomains()</category><category>NSTemporaryDirectory()</category><category>NSUserName()</category><category>Snippets</category><category>stringByAppendingPathComponent</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Giovambattista Fazioli</dc:creator><pubDate>Fri, 20 Nov 2009 15:40:07 PST</pubDate><guid isPermaLink="false">http://www.undolog.com/?p=2668</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/Vt3egJSI0hicUS_6DadiVwoamKk/0/da"><img src="http://feedads.g.doubleclick.net/~a/Vt3egJSI0hicUS_6DadiVwoamKk/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Vt3egJSI0hicUS_6DadiVwoamKk/1/da"><img src="http://feedads.g.doubleclick.net/~a/Vt3egJSI0hicUS_6DadiVwoamKk/1/di" border="0" ismap="true"></img></a></p><p>Sia sul Mac OS X che sull'iPhone OS, abbiamo la possibilità di accedere in modo semplice e diretto alle directory -  più importanti - di sistema, che sono:</p>
<div class="igBar"><span id="lcode-111"><a href="#" onclick="javascript:showCodeTxt('code-111'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-111">
<div class="code" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSHomeDirectory &nbsp; &nbsp; &nbsp; &nbsp; Returns the path to the current user’s home directory.</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="">NSHomeDirectoryForUser</span>&nbsp; Returns the path to a given user’s home directory.</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="">NSTemporaryDirectory</span>&nbsp; &nbsp; Returns the path of the temporary directory for the current user.</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Ecco il codice necessario per utilizzarle:</p>
<div class="igBar"><span id="lobjc-112"><a href="#" onclick="javascript:showCodeTxt('objc-112'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-112">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// Directory principali</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>homePath <span style="color: #002200;">=</span> NSHomeDirectory<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>tempPath <span style="color: #002200;">=</span> NSTemporaryDirectory<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>;&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>userPath <span style="color: #002200;">=</span> NSHomeDirectoryForUser<span style="color: #002200;">&#40;</span> NSUserName<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;homePath = %@&quot;</span>, homePath<span style="color: #002200;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;tempPath = %@&quot;</span>, tempPath<span style="color: #002200;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;userPath = %@&quot;</span>, userPath<span style="color: #002200;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// homePath = /var/mobile/Applications/C7B94C13-DCEC-40CD-942F-93FD302BF905</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// tempPath = /private/var/mobile/Applications/C7B94C13-DCEC-40CD-942F-93FD302BF905/tmp/</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// userPath = /var/mobile/Applications/C7B94C13-DCEC-40CD-942F-93FD302BF905</span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<blockquote><p><strong>Nota</strong>: avete notato, riga 4, la chiamata a <code>NSUserName()</code> che ritorna il "current user"</p></blockquote>
<p>Esistono, poi, tutta una serie di altre "cartelle" a cui possiamo accedere. Queste possono essere ottenute attraverso la chiamata alla funzione <code>NSSearchPathForDirectoriesInDomains()</code> passandogli come inputs una serie di costanti. Ad esempio possiamo ottenere la cartella <strong>Documents</strong> in questo modo:</p>
<div class="igBar"><span id="lobjc-113"><a href="#" onclick="javascript:showCodeTxt('objc-113'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-113">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span style="color: #400080;">NSArray</span></a> <span style="color: #002200;">*</span>paths <span style="color: #002200;">=</span> NSSearchPathForDirectoriesInDomains<span style="color: #002200;">&#40;</span>NSDocumentDirectory, NSUserDomainMask, <span style="color: #a61390;">YES</span><span style="color: #002200;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;paths = %@&quot;</span>, paths<span style="color: #002200;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// paths = ( &quot;/var/mobile/Applications/C7B94C13-DCEC-40CD-942F-93FD302BF905/Documents&quot; )</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// Cartella Documents</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>documentsPath <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>paths objectAtIndex<span style="color: #002200;">:</span>0<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;documentsPath = %@&quot;</span>, documentsPath<span style="color: #002200;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// documentsPath = /var/mobile/Applications/C7B94C13-DCEC-40CD-942F-93FD302BF905/Documents</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// Oppure...</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>documentsDirectory <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>NSHomeDirectory<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span> stringByAppendingPathComponent<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Documents&quot;</span><span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;documentsDirectory = %@&quot;</span>, documentsDirectory<span style="color: #002200;">&#41;</span>;&nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// documentsDirectory = /var/mobile/Applications/C7B94C13-DCEC-40CD-942F-93FD302BF905/Documents</span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<blockquote><p><strong>Nota</strong>: in questo ultimo caso notate l'uso di <code>stringByAppendingPathComponent</code> che "concatena" Documents al path, aggiungendo lo slash</p></blockquote>
<p><code>NSSearchPathForDirectoriesInDomains()</code> ritorna sempre un array di stringhe, anche se nella maggiornaza dei casi gli elementi sono solo uno. Se guardate bene l'output di <code>paths</code>, infatti, viene indicato tra parentesi, cioè un'array. Nel primo caso viene estratto il primo elemento con <code>[paths objectAtIndex:0]</code>.</p>
<h4>Risorse</h4>
<p>Tramite l'oggetto <code>NSBundle</code>, invece, accediamo alla cartella delle risorse di una applicazione; come già sapete, l'estensione <code>.app</code> delle applicazioni Mac è "virtuale", per non dire fittizia. Essa, infatti, cela una sorta di "cartella" con all'interno tutte le risorse necessarie all'applicazione stessa, tra cui l'eseguibile vero e proprio! <img src='http://www.undolog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div class="igBar"><span id="lobjc-114"><a href="#" onclick="javascript:showCodeTxt('objc-114'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-114">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// Applicazione</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>appFolderPath <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/"><span style="color: #400080;">NSBundle</span></a> mainBundle<span style="color: #002200;">&#93;</span> resourcePath<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;appFolderPath = %@&quot;</span>, appFolderPath<span style="color: #002200;">&#41;</span>;&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// appFolderPath = /var/mobile/Applications/54A1A3C9-322E-4C23-B096-45869B0332A5/MyApp.app</span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h4>Elencare il contenuto di una cartella (browsing)</h4>
<p>Il File Management, gestito dall'oggetto <a target="_blank" href="http://developer.apple.com/iPhone/library/documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html"><code>NSFileManager</code></a>, permette di eseguire moltissime utili operazioni come:</p>
<ul>
<li>Creare directory e file</li>
<li>Copiare, spostare e "linkare" file e directory</li>
<li>Confrontare file e directory</li>
<li>Ottenere il contenuto di directory</li>
<li>e altro ancora...</li>
</ul>
<p>Ad esempio...</p>
<div class="igBar"><span id="lobjc-115"><a href="#" onclick="javascript:showCodeTxt('objc-115'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-115">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// Elenco Directory</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> &nbsp; &nbsp; &nbsp;<span style="color: #002200;">*</span>homePath &nbsp; &nbsp;<span style="color: #002200;">=</span> NSHomeDirectory<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/"><span style="color: #400080;">NSFileManager</span></a> <span style="color: #002200;">*</span>fileManager <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/"><span style="color: #400080;">NSFileManager</span></a> defaultManager<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;La cartella %@ contiene = %@&quot;</span>, homePath, <span style="color: #002200;">&#91;</span>fileManager directoryContentsAtPath<span style="color: #002200;">:</span> homePath<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// La cartella /var/mobile/Applications/C7B94C13-DCEC-40CD-942F-93FD302BF905/ contiene = (</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// Documents,</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// Library,</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// &quot;MyApp.app&quot;,</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// tmp</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// )</span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h4>Bonus</h4>
<p>Per quanto riguarda le informazioni "utente" abbiammo:</p>
<div class="igBar"><span id="lobjc-116"><a href="#" onclick="javascript:showCodeTxt('objc-116'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-116">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// FullUserName</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>fullUserName <span style="color: #002200;">=</span> NSFullUserName<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;fullUserName = %@&quot;</span>, fullUserName<span style="color: #002200;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// fullUserName = Mobile User</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// NSUserName</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>userName <span style="color: #002200;">=</span> NSUserName<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;userName = %@&quot;</span>, userName<span style="color: #002200;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// userName = mobile</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// NSHomeDirectoryForUser</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>directoryForUser <span style="color: #002200;">=</span> NSHomeDirectoryForUser<span style="color: #002200;">&#40;</span> userName <span style="color: #002200;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;directoryForUser = %@&quot;</span>, directoryForUser<span style="color: #002200;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// directoryForUser = /var/mobile/Applications/DFD6AED2-6B14-4515-8DCD-2AF6F6C2E00C</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Lascio a voi provare le "differenze" tra l'uso del simulatore e il device.</p>




	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F21%2Fvery-short-snippet-apple-iphone-file-system%2F&amp;title=Very%20short%20snippet%3A%20Apple%20iPhone%20file%20system&amp;bodytext=Sia%20sul%20Mac%20OS%20X%20che%20sull%27iPhone%20OS%2C%20abbiamo%20la%20possibilit%C3%A0%20di%20accedere%20in%20modo%20semplice%20e%20diretto%20alle%20directory%20-%20%20pi%C3%B9%20importanti%20-%20di%20sistema%2C%20che%20sono%3A%0D%0A%5Bcode%5D%0D%0ANSHomeDirectory%09%20%20%20%20%20%20%20%20Returns%20the%20path%20to%20the%20current%20user%E2%80%99s%20home%20directory.%0D%0AN" title="Digg"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F21%2Fvery-short-snippet-apple-iphone-file-system%2F&amp;title=Very%20short%20snippet%3A%20Apple%20iPhone%20file%20system&amp;notes=Sia%20sul%20Mac%20OS%20X%20che%20sull%27iPhone%20OS%2C%20abbiamo%20la%20possibilit%C3%A0%20di%20accedere%20in%20modo%20semplice%20e%20diretto%20alle%20directory%20-%20%20pi%C3%B9%20importanti%20-%20di%20sistema%2C%20che%20sono%3A%0D%0A%5Bcode%5D%0D%0ANSHomeDirectory%09%20%20%20%20%20%20%20%20Returns%20the%20path%20to%20the%20current%20user%E2%80%99s%20home%20directory.%0D%0AN" title="del.icio.us"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F21%2Fvery-short-snippet-apple-iphone-file-system%2F" title="Technorati"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F21%2Fvery-short-snippet-apple-iphone-file-system%2F&amp;t=Very%20short%20snippet%3A%20Apple%20iPhone%20file%20system" title="Facebook"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F21%2Fvery-short-snippet-apple-iphone-file-system%2F&amp;title=Very%20short%20snippet%3A%20Apple%20iPhone%20file%20system&amp;annotation=Sia%20sul%20Mac%20OS%20X%20che%20sull%27iPhone%20OS%2C%20abbiamo%20la%20possibilit%C3%A0%20di%20accedere%20in%20modo%20semplice%20e%20diretto%20alle%20directory%20-%20%20pi%C3%B9%20importanti%20-%20di%20sistema%2C%20che%20sono%3A%0D%0A%5Bcode%5D%0D%0ANSHomeDirectory%09%20%20%20%20%20%20%20%20Returns%20the%20path%20to%20the%20current%20user%E2%80%99s%20home%20directory.%0D%0AN" title="Google Bookmarks"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Very%20short%20snippet%3A%20Apple%20iPhone%20file%20system%20-%20http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F21%2Fvery-short-snippet-apple-iphone-file-system%2F" title="Twitter"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://barrapunto.com/submit.pl?subj=Very%20short%20snippet%3A%20Apple%20iPhone%20file%20system&amp;story=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F21%2Fvery-short-snippet-apple-iphone-file-system%2F" title="BarraPunto"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://current.com/clipper.htm?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F21%2Fvery-short-snippet-apple-iphone-file-system%2F&amp;title=Very%20short%20snippet%3A%20Apple%20iPhone%20file%20system" title="Current"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/current.png" title="Current" alt="Current" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=Very%20short%20snippet%3A%20Apple%20iPhone%20file%20system&amp;body=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F21%2Fvery-short-snippet-apple-iphone-file-system%2F" title="email"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Very%20short%20snippet%3A%20Apple%20iPhone%20file%20system&amp;link=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F21%2Fvery-short-snippet-apple-iphone-file-system%2F" title="FriendFeed"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://laaik.it/NewStoryCompact.aspx?uri=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F21%2Fvery-short-snippet-apple-iphone-file-system%2F&amp;headline=Very%20short%20snippet%3A%20Apple%20iPhone%20file%20system&amp;cat=5e082fcc-8a3b-47e2-acec-fdf64ff19d12" title="laaik.it"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/laaikit.png" title="laaik.it" alt="laaik.it" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F21%2Fvery-short-snippet-apple-iphone-file-system%2F&amp;title=Very%20short%20snippet%3A%20Apple%20iPhone%20file%20system&amp;source=Undolog.com+Research+%26amp%3B+Development++Blog&amp;summary=Sia%20sul%20Mac%20OS%20X%20che%20sull%27iPhone%20OS%2C%20abbiamo%20la%20possibilit%C3%A0%20di%20accedere%20in%20modo%20semplice%20e%20diretto%20alle%20directory%20-%20%20pi%C3%B9%20importanti%20-%20di%20sistema%2C%20che%20sono%3A%0D%0A%5Bcode%5D%0D%0ANSHomeDirectory%09%20%20%20%20%20%20%20%20Returns%20the%20path%20to%20the%20current%20user%E2%80%99s%20home%20directory.%0D%0AN" title="LinkedIn"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F21%2Fvery-short-snippet-apple-iphone-file-system%2F&amp;title=Very%20short%20snippet%3A%20Apple%20iPhone%20file%20system" title="Live"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F21%2Fvery-short-snippet-apple-iphone-file-system%2F&amp;t=Very%20short%20snippet%3A%20Apple%20iPhone%20file%20system" title="MySpace"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Very%20short%20snippet%3A%20Apple%20iPhone%20file%20system&amp;url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F21%2Fvery-short-snippet-apple-iphone-file-system%2F" title="Netvibes"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F21%2Fvery-short-snippet-apple-iphone-file-system%2F&amp;partner=sociable" title="Print"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.undolog.com/feed/" title="RSS"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://segnalo.alice.it/post.html.php?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F21%2Fvery-short-snippet-apple-iphone-file-system%2F&amp;title=Very%20short%20snippet%3A%20Apple%20iPhone%20file%20system" title="Segnalo"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/segnalo.png" title="Segnalo" alt="Segnalo" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F21%2Fvery-short-snippet-apple-iphone-file-system%2F&amp;title=Very%20short%20snippet%3A%20Apple%20iPhone%20file%20system" title="StumbleUpon"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.wikio.it/vote?url=http%3A%2F%2Fwww.undolog.com%2F2009%2F11%2F21%2Fvery-short-snippet-apple-iphone-file-system%2F" title="Wikio IT"><img src="http://www.undolog.com/wp-content/plugins/sociable/images/wikio.png" title="Wikio IT" alt="Wikio IT" class="sociable-hovers" /></a>


<br/><br/>
	Tags: <a href="http://www.undolog.com/tag/apple/" title="Apple" rel="tag">Apple</a>, <a href="http://www.undolog.com/tag/apple-iphone/" title="Apple iPhone" rel="tag">Apple iPhone</a>, <a href="http://www.undolog.com/category/sviluppo/iphone-sviluppo/" title="iPhone" rel="tag">iPhone</a>, <a href="http://www.undolog.com/category/mobile/" title="Mobile" rel="tag">Mobile</a>, <a href="http://www.undolog.com/tag/nsbundle/" title="NSBundle" rel="tag">NSBundle</a>, <a href="http://www.undolog.com/tag/nsdocumentdirectory/" title="NSDocumentDirectory" rel="tag">NSDocumentDirectory</a>, <a href="http://www.undolog.com/tag/nsfilemanager/" title="NSFileManager" rel="tag">NSFileManager</a>, <a href="http://www.undolog.com/tag/nsfullusername/" title="NSFullUserName()" rel="tag">NSFullUserName()</a>, <a href="http://www.undolog.com/tag/nshomedirectory/" title="NSHomeDirectory()" rel="tag">NSHomeDirectory()</a>, <a href="http://www.undolog.com/tag/nshomedirectoryforuser/" title="NSHomeDirectoryForUser()" rel="tag">NSHomeDirectoryForUser()</a>, <a href="http://www.undolog.com/tag/nssearchpathfordirectoriesindomains/" title="NSSearchPathForDirectoriesInDomains()" rel="tag">NSSearchPathForDirectoriesInDomains()</a>, <a href="http://www.undolog.com/tag/nstemporarydirectory/" title="NSTemporaryDirectory()" rel="tag">NSTemporaryDirectory()</a>, <a href="http://www.undolog.com/tag/nsusername/" title="NSUserName()" rel="tag">NSUserName()</a>, <a href="http://www.undolog.com/tag/objective-c/" title="Objective-C" rel="tag">Objective-C</a>, <a href="http://www.undolog.com/category/sviluppo/iphone-sviluppo/objective-c-sviluppo/" title="Objective-C" rel="tag">Objective-C</a>, <a href="http://www.undolog.com/tag/snippets/" title="Snippets" rel="tag">Snippets</a>, <a href="http://www.undolog.com/tag/stringbyappendingpathcomponent/" title="stringByAppendingPathComponent" rel="tag">stringByAppendingPathComponent</a>, <a href="http://www.undolog.com/category/sviluppo/" title="Sviluppo" rel="tag">Sviluppo</a><br />

	<h4>Post correlati</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.undolog.com/2009/10/09/very-short-snippet-iphone-numeri-casuali/" title="Very short snippet: iPhone, numeri casuali (9 ottobre, 2009)">Very short snippet: iPhone, numeri casuali</a> (0)</li>
	<li><a href="http://www.undolog.com/2009/07/10/xcode-organizzare-il-codice-con-la-direttiva-pragma-mark/" title="XCode: organizzare il codice con la direttiva #pragma mark (10 luglio, 2009)">XCode: organizzare il codice con la direttiva #pragma mark</a> (0)</li>
	<li><a href="http://www.undolog.com/2009/07/23/xcode-shortcut/" title="Xcode shortcut (23 luglio, 2009)">Xcode shortcut</a> (0)</li>
	<li><a href="http://www.undolog.com/2009/06/16/very-short-trick-fermare-nstimer/" title="Very short trick: fermare NSTimer (16 giugno, 2009)">Very short trick: fermare NSTimer</a> (0)</li>
	<li><a href="http://www.undolog.com/2009/12/01/very-short-snippet-streaming-mp3-file-su-apple-iphone/" title="Very short snippet: streaming mp3 file su Apple iPhone (1 dicembre, 2009)">Very short snippet: streaming mp3 file su Apple iPhone</a> (0)</li>
</ul>

<img src="http://feeds.feedburner.com/~r/undolog/~4/cVTPjnRkkoI" height="1" width="1"/>]]></content:encoded><description>Sia sul Mac OS X che sull'iPhone OS, abbiamo la possibilità di accedere in modo semplice e diretto alle directory -  più importanti - di sistema, che sono:
PLAIN TEXT
CODE:




NSHomeDirectory &amp;#160; &amp;#160; &amp;#160; &amp;#160; Returns the path to the current user’s home directory.


NSHomeDirectoryForUser&amp;#160; Returns the path to a given user’s home directory.


NSTemporaryDirectory&amp;#160; &amp;#160; Returns the [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.undolog.com/2009/11/21/very-short-snippet-apple-iphone-file-system/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://www.undolog.com/2009/11/21/very-short-snippet-apple-iphone-file-system/</feedburner:origLink></item><item><title>10 utili trucchi e snippet per Apple iPhone e Xcode</title><link>http://feedproxy.google.com/~r/undolog/~3/gGi_-6dNW9U/</link><category>Featured</category><category>Mobile</category><category>Objective-C</category><category>Sviluppo</category><category>iPhone</category><category>Activity Indicator</category><category>Apple</category><category>Camera</category><category>Device</category><category>Framework</category><category>iPod</category><category>iPod Touch</category><category>Localizzazione</category><category>Reachability</category><category>Snipp</category><category>tips-&amp;-tricks</category><category>UIActivityIndicatorView</category><category>UIApplication</category><category>UIDevice</category><category>UIImagePickerController</category><category>UIWebView</category><category>ViewController</category><category>XCode</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Giovambattista Fazioli</dc:creator><pubDate>Thu, 12 Nov 2009 12:40:17 PST</pubDate><guid isPermaLink="false">http://www.undolog.com/?p=2645</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/88ehsQ45Y2PAP_NCIYz2604fvmI/0/da"><img src="http://feedads.g.doubleclick.net/~a/88ehsQ45Y2PAP_NCIYz2604fvmI/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/88ehsQ45Y2PAP_NCIYz2604fvmI/1/da"><img src="http://feedads.g.doubleclick.net/~a/88ehsQ45Y2PAP_NCIYz2604fvmI/1/di" border="0" ismap="true"></img></a></p><h4>1. Stringhe su più righe</h4>
<p>In Xcode è possibile "spezzare" un stringa su più righe inserendo a alla fine un backslash "\". Questa caratteristica può risultare utilissima quando, ad esempio, vogliamo inserire del testo HTML in un controllo <strong><code>UIWebView</code></strong>:</p>
<div class="igBar"><span id="lobjc-117"><a href="#" onclick="javascript:showCodeTxt('objc-117'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-117">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>htmlData <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot; <span style="color: #2400d9;">\</span></span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #bf1d1a;">&lt;html&gt;&lt;head&gt; <span style="color: #2400d9;">\</span></span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #bf1d1a;">&lt;style type=<span style="color: #2400d9;">\&quot;</span>text/css<span style="color: #2400d9;">\&quot;</span>&gt; <span style="color: #2400d9;">\</span></span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #bf1d1a;">body {background:#000;color:#fff} <span style="color: #2400d9;">\</span></span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #bf1d1a;">&lt;/style&gt; <span style="color: #2400d9;">\</span></span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #bf1d1a;">&lt;title&gt;Report&lt;/title&gt;&lt;/head&gt; <span style="color: #2400d9;">\</span></span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #bf1d1a;">&lt;body&gt; <span style="color: #2400d9;">\</span></span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #bf1d1a;">&lt;h1&gt;Prova HTML&lt;/h1&gt; <span style="color: #2400d9;">\</span></span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #bf1d1a;">&lt;ul&gt; <span style="color: #2400d9;">\</span></span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #bf1d1a;">&lt;li&gt;Testo HTML&lt;/li&gt; <span style="color: #2400d9;">\</span></span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #bf1d1a;">&lt;li&gt;Inserito su&lt;/li&gt; <span style="color: #2400d9;">\</span></span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #bf1d1a;">&lt;li&gt;piu' righe&lt;/li&gt; <span style="color: #2400d9;">\</span></span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #bf1d1a;">&lt;/ul&gt;&lt;/body&gt;&lt;/html&gt;&quot;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span>webView loadHTMLString<span style="color: #002200;">:</span>htmlData baseURL<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span style="color: #400080;">NSURL</span></a> URLWithString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;http://www.saidmade.com/&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h4>2. Transizioni tra View con effetto "foglio piegato"</h4>
<p>Ecco una funzione utile per sfogliare, e risflogliare, due <code>UIView</code>:</p>
<div class="igBar"><span id="lobjc-118"><a href="#" onclick="javascript:showCodeTxt('objc-118'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-118">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// Esegue una transizione con effetto CURL da una UIView a una UIView</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// @params &nbsp;placeholder &nbsp; &nbsp; &nbsp; &nbsp; (UIView) principale</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// @params &nbsp;fview &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (UIView) di partenza</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// @params &nbsp;tview &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (UIView) di arrivo</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// @params &nbsp;forward &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (BOOL) sfoglia verso l'alto o verso il basso</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>makeTansitionFromView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIWindow <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>placeholder fromView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>fview toView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tview forward<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>forward <span style="color: #002200;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>UIView beginAnimations<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> context<span style="color: #002200;">:</span><span style="color: #a61390;">NULL</span><span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>UIView setAnimationDuration<span style="color: #002200;">:</span>1.5<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>UIView setAnimationTransition<span style="color: #002200;">:</span>forward?UIViewAnimationTransitionCurlUp<span style="color: #002200;">:</span>UIViewAnimationTransitionCurlDown forView<span style="color: #002200;">:</span>placeholder cache<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>tview removeFromSuperview<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>placeholder addSubview<span style="color: #002200;">:</span>fview<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>fview removeFromSuperview<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>placeholder addSubview<span style="color: #002200;">:</span>tview<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>UIView commitAnimations<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#125;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Può essere utilizzata in questo modo:</p>
<div class="igBar"><span id="lobjc-119"><a href="#" onclick="javascript:showCodeTxt('objc-119'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-119">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// visualizzo - sfoglio in avanti</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span>self makeTansitionFromView<span style="color: #002200;">:</span>window fromView<span style="color: #002200;">:</span>primaView.view toView<span style="color: #002200;">:</span>secondaView.view forward<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// nascondo - sfoglio indietro</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span>self makeTansitionFromView<span style="color: #002200;">:</span>window fromView<span style="color: #002200;">:</span>secondaView.view toView<span style="color: #002200;">:</span>primaView.view forward<span style="color: #002200;">:</span><span style="color: #a61390;">NO</span><span style="color: #002200;">&#93;</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h4>3. Impedire l'auto oscuramento del display</h4>
<p>Da usare con cura, pena il consumo immediato della batteria, questa riga di codice permette di mantenere la nostra applicazione sempre visibile, impedendo che l'Apple iPhone vada in "stand-by":</p>
<div class="igBar"><span id="lobjc-120"><a href="#" onclick="javascript:showCodeTxt('objc-120'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-120">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span>UIApplication sharedApplication<span style="color: #002200;">&#93;</span>.idleTimerDisabled <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h4>4. Network Activity Indicator</h4>
<p>L'animazione che compare sulla barra di stato in alto allo schermo dell'Apple iPhone, può essere utilizzata anche nelle nostre applicazioni per sottolineare un'attività di rete:</p>
<div class="igBar"><span id="lobjc-121"><a href="#" onclick="javascript:showCodeTxt('objc-121'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-121">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// Mostra Network Activity Indicator ...</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span>UIApplication sharedApplication<span style="color: #002200;">&#93;</span>.networkActivityIndicatorVisible <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// Le tue operazioni ...</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// Nasconde Network Activity Indicator ...</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span>UIApplication sharedApplication<span style="color: #002200;">&#93;</span>.networkActivityIndicatorVisible <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h4>5. Activity Indicator personale</h4>
<p>Se non si dispone della barra di stato, può tornare utile mostrare un nostro <strong>Activity Indicator</strong>:</p>
<div class="igBar"><span id="lobjc-122"><a href="#" onclick="javascript:showCodeTxt('objc-122'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-122">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// globale da qualche parte... dipo in un Delegate (.h)</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">UIActivityIndicatorView <span style="color: #002200;">*</span>activity;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// Nella loadView o viewDidLoad inizializziamo l'Activity Indicator </span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">activity <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIActivityIndicatorView alloc<span style="color: #002200;">&#93;</span> initWithActivityIndicatorStyle<span style="color: #002200;">:</span>UIActivityIndicatorViewStyleWhite<span style="color: #002200;">&#93;</span>;&nbsp; </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span>self.view addSubview<span style="color: #002200;">:</span>activity<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span>activity setCenter<span style="color: #002200;">:</span>CGPointMake<span style="color: #002200;">&#40;</span>160, 240<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#91;</span>activity stopAnimating<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// Quando ci serve</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>someMethod <span style="color: #002200;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>activity startAnimating<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// to doing...</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>activity stopAnimating<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#125;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h4>6. Localizzazione</h3>
<p>Tramite questo snippet è possibile capire in che "lingua" è impostato il nostro device:</p>
<div class="igBar"><span id="lobjc-123"><a href="#" onclick="javascript:showCodeTxt('objc-123'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-123">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// Checking language and localization</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSUserDefaults_Class/"><span style="color: #400080;">NSUserDefaults</span></a> &nbsp;<span style="color: #002200;">*</span>defaults &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSUserDefaults_Class/"><span style="color: #400080;">NSUserDefaults</span></a> standardUserDefaults<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span style="color: #400080;">NSArray</span></a> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">*</span>languages &nbsp; &nbsp; &nbsp; <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>defaults objectForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;AppleLanguages&quot;</span><span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #002200;">*</span>currentLanguage <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>languages objectAtIndex<span style="color: #002200;">:</span>0<span style="color: #002200;">&#93;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Current Locale: %@&quot;</span>, <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSLocale_Class/"><span style="color: #400080;">NSLocale</span></a> currentLocale<span style="color: #002200;">&#93;</span> localeIdentifier<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Current language: %@&quot;</span>, currentLanguage<span style="color: #002200;">&#41;</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h4>7. iPhone o iPod?</h4>
<p>Questa classe è utilissima per determinare su quale dispositivo Apple sta funzionando la nostra applicazione. Non solo possiamo determinare il modello (iPhone o iPod Touch) ma anche la versione. Create due file <code>UIDevice-hardware.h</code> e <code>UIDevice-hardware.m</code>:</p>
<div class="igBar"><span id="lobjc-124"><a href="#" onclick="javascript:showCodeTxt('objc-124'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-124">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// UIDevice-hardware.h</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#import &lt;UIKit/UIKit.h&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#define IPHONE_1G_NAMESTRING @&quot;iPhone 1G&quot;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#define IPHONE_3G_NAMESTRING @&quot;iPhone 3G&quot;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#define IPHONE_3GS_NAMESTRING @&quot;iPhone 3GS&quot;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#define IPOD_1G_NAMESTRING @&quot;iPod touch 1G&quot;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#define IPOD_2G_NAMESTRING @&quot;iPod touch 2G&quot;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #a61390;">@interface</span> UIDevice <span style="color: #002200;">&#40;</span>Hardware<span style="color: #002200;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> platform;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> platformString;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #a61390;">@end</span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div class="igBar"><span id="lobjc-125"><a href="#" onclick="javascript:showCodeTxt('objc-125'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Objective-C:</span>
<div id="objc-125">
<div class="objc" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #11740a; font-style: italic;">// UIDevice-hardware.m</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2e