<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blog d&#039;un développeur multi-support &#187; iPhone</title>
	<atom:link href="http://www.oni-ecchi.info/blog/tag/iphone/feed" rel="self" type="application/rss+xml" />
	<link>http://www.oni-ecchi.info/blog</link>
	<description>[DIM] pour les intimes :)</description>
	<lastBuildDate>Mon, 06 Feb 2012 18:51:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>deux nouveaux articles iPhone !</title>
		<link>http://www.oni-ecchi.info/blog/iphone/deux-nouveaux-articles-iphone.html</link>
		<comments>http://www.oni-ecchi.info/blog/iphone/deux-nouveaux-articles-iphone.html#comments</comments>
		<pubDate>Fri, 18 Jun 2010 06:27:38 +0000</pubDate>
		<dc:creator>Guillaume chave</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[tutoriel]]></category>

		<guid isPermaLink="false">http://www.oni-ecchi.info/blog/uncategorized/deux-nouveaux-articles-iphone.html</guid>
		<description><![CDATA[Bonjour, J&#8217;ai écrit deux nouveaux articles iPhone pour le compte de l&#8217;excellent blog technique d&#8217;elao voici les liens d&#8217;accès direct : http://www.elao.org/iphone/frameworks-iphone.html : Je présente rapidement le framework Three20 et son système de navigation par URL http://www.elao.org/iphone/three20-menu-tttabstrip.html : J&#8217;explique comment créer un menu horizontale intelligent avec Three20 Dorénavant les articles iPhone seront annoncés ici mais [...]]]></description>
			<content:encoded><![CDATA[<p>Bonjour,</p>
<p>J&#8217;ai écrit deux nouveaux articles <a href="http://www.oni-ecchi.info/blog/tag/iphone" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec iPhone">iPhone</a> pour le compte de l&#8217;excellent <a href="http://www.elao.org">blog technique d&#8217;elao</a> voici les liens d&#8217;accès direct :</p>
<ol>
<li><a href="http://www.elao.org/iphone/frameworks-iphone.html">http://www.elao.org/iphone/frameworks-iphone.html</a> : Je présente rapidement <a href="http://www.three20.info" target="_blank">le framework Three20</a> et son système de <strong><a href="http://www.oni-ecchi.info/blog/tag/navigation" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec navigation">navigation</a> par URL</strong><a href="http://www.three20.info" target="_blank"><br />
</a></li>
<li><a href="http://www.elao.org/iphone/three20-menu-tttabstrip.html">http://www.elao.org/iphone/three20-menu-tttabstrip.html</a> : J&#8217;explique comment<strong> créer un menu</strong> horizontale intelligent avec Three20</li>
</ol>
<p>Dorénavant les articles iPhone seront annoncés ici mais mis en ligne sur le blog technique.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.oni-ecchi.info/blog/iphone/deux-nouveaux-articles-iphone.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Elao sur iPhone</title>
		<link>http://www.oni-ecchi.info/blog/iphone/elao-sur-iphone.html</link>
		<comments>http://www.oni-ecchi.info/blog/iphone/elao-sur-iphone.html#comments</comments>
		<pubDate>Wed, 09 Jun 2010 08:09:36 +0000</pubDate>
		<dc:creator>Guillaume chave</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[application]]></category>

		<guid isPermaLink="false">http://www.oni-ecchi.info/blog/?p=550</guid>
		<description><![CDATA[Elao ? Elao est la société qui m&#8217;emploie, elle est spécialisée dans le développement d&#8217;application web (avec symfony) et depuis peu sur iPhone. Afin de montrer son savoir faire, la team iphone, dont je fais partie, a crée une petite application très classique pour voir les nouveautés de la société, voir ses références, etc. Techniquement [...]]]></description>
			<content:encoded><![CDATA[<h3><a href="http://www.elao.com">Elao</a> ?</h3>
<p><strong>Elao</strong> est la société qui m&#8217;emploie, elle est<strong> spécialisée dans le développement</strong> d&#8217;application web (avec <strong><a href="http://www.oni-ecchi.info/blog/tag/symfony" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec Symfony">symfony</a></strong>) et depuis peu sur <strong><a href="http://www.oni-ecchi.info/blog/tag/iphone" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec iPhone">iPhone</a></strong>.</p>
<p>Afin de montrer son savoir faire, la team iphone, dont je fais partie, a crée une petite application très classique pour voir les nouveautés de la société, voir ses références, etc.</p>
<p><strong>Techniquement</strong> nous avons utilisé <a href="http://three20.info/" target="_blank">three20</a>, un framework iPhone qui fournie de nombreuse classe et d&#8217;utilitaire bien pratique, comme la <a href="http://www.oni-ecchi.info/blog/tag/navigation" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec navigation">navigation</a> par URL.</p>
<p>Je vous invite à l&#8217;<strong>essayer</strong> et à me dire ce que vous en pensez. Disponible sur iTunes : <a href="http://itunes.apple.com/fr/app/elao/id375943180?mt=8">http://itunes.apple.com/fr/app/elao/id375943180?mt=8</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.oni-ecchi.info/blog/iphone/elao-sur-iphone.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Iphone &amp; C#, drole de mariage</title>
		<link>http://www.oni-ecchi.info/blog/iphone/iphone-c-drole-de-mariage.html</link>
		<comments>http://www.oni-ecchi.info/blog/iphone/iphone-c-drole-de-mariage.html#comments</comments>
		<pubDate>Sun, 31 Jan 2010 08:22:12 +0000</pubDate>
		<dc:creator>Guillaume chave</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[découverte]]></category>

		<guid isPermaLink="false">http://www.oni-ecchi.info/blog/?p=508</guid>
		<description><![CDATA[Aujourd&#8217;hui je suis tombé sur l&#8217;article de PC Inpact comme quoi une société propose un kit de développement (SDK) pour développer en C# des application native iphone, son nom MonoTouch De ce que j&#8217;ai compris, il faut quand même un mac, on code toujours sur Xcode, mais au lieu d&#8217;apprendre l&#8217;objective-c on le fait en [...]]]></description>
			<content:encoded><![CDATA[<p>Aujourd&#8217;hui je suis tombé sur l&#8217;article de <a href="http://www.pcinpact.com/actu/news/53020-apple-iphone-mono-novell-xcode.htm">PC Inpact</a> comme quoi une société propose un kit de développement (SDK) pour développer en C# des application native <a href="http://www.oni-ecchi.info/blog/tag/iphone" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec iPhone">iphone</a>, son nom <a href="http://monotouch.net/">MonoTouch</a></p>
<p>De ce que j&#8217;ai compris, <strong>il faut quand même un mac</strong>, on code <strong>toujours sur Xcode</strong>, mais au lieu d&#8217;apprendre l&#8217;objective-c on le fait en C#. On utilise toujours Interface builder, on a toujours besoin d&#8217;une licence Apple&#8230; bref c&#8217;est tout pareil, sauf qu&#8217;on<strong> change de langage de programmation.</strong></p>
<p>Je viens de regarder un <a href="http://www.oni-ecchi.info/blog/tag/tutoriel" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec tutoriel">tutoriel</a> <a href="http://monotouch.net/">monotouch</a> pour créer un lecteur de flux RSS (quasi un des premier tuto que l&#8217;on fait en <a href="http://www.oni-ecchi.info/blog/tag/objective-c" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec objective c">objective C</a>) à cette <a href="http://www.alexyork.net/blog/post/UINavigationController-with-MonoTouch-Building-a-simple-RSS-reader-Part-1.aspx">adresse</a>. J&#8217;ai été bluffé, ca a l&#8217;air presque trop simple :p</p>
<p>Mais bon, ceux que j&#8217;oublie de dire c&#8217;est qu&#8217;il faut mettre la main au portefeuille pour avoir ce kit, <strong>les prix vont de $399 à $3,999 PAR AN</strong> :/ </p>
<p>Ça à l&#8217;air vraiment pas mal, mais bon à titre personnel je pense qu&#8217;à ce prix là je préfèrerais re-apprendre l&#8217;objective-C. Un bon développeur ne doit il pas être capable de changer de langage de programmation comme de chemise ? </p>
<p>ps : Ça ressemble à un bon cheval de troie pour les développeurs Microsoft, un peu comme l&#8217;est le kit Adobe dans la suite CS5 pour développer en Flash des applications natives. Tout le monde veut sa part du gâteau de l&#8217;App Store on dirait..  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.oni-ecchi.info/blog/iphone/iphone-c-drole-de-mariage.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Retour de vacances</title>
		<link>http://www.oni-ecchi.info/blog/guillaume-chave/retour-de-vacances.html</link>
		<comments>http://www.oni-ecchi.info/blog/guillaume-chave/retour-de-vacances.html#comments</comments>
		<pubDate>Fri, 28 Aug 2009 08:08:37 +0000</pubDate>
		<dc:creator>Guillaume chave</dc:creator>
				<category><![CDATA[About me :)]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[moi]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://www.oni-ecchi.info/blog/?p=466</guid>
		<description><![CDATA[Me voici de retour, Je préviens que ce blog risque de ne pas être mis à jour pendant encore un moment. J&#8217;emménage à Lyon, je change de job, et je n&#8217;aurais plus de mac pour développez sur iphone tout de suite. Donc pour les lecteurs &#171;&#160;iphone&#160;&#187; du blog désolé mais c&#8217;est chômage technique en vue. [...]]]></description>
			<content:encoded><![CDATA[<p>Me voici de retour,</p>
<p>Je préviens que ce blog risque de ne<strong> pas être mis à jour</strong> pendant encore un moment. J&#8217;emménage à <a class="zem_slink" title="Lyon" rel="geolocation" href="http://maps.google.com/maps?ll=45.7669444444,4.83416666667&amp;spn=0.1,0.1&amp;q=45.7669444444,4.83416666667%20%28Lyon%29&amp;t=h">Lyon</a>, je change de job, et je n&#8217;aurais plus de mac pour développez sur <a href="http://www.oni-ecchi.info/blog/tag/iphone" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec iPhone">iphone</a> tout de suite. Donc pour les lecteurs &laquo;&nbsp;<a href="http://www.oni-ecchi.info/blog/tag/iphone" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec iPhone">iphone</a>&nbsp;&raquo; du blog désolé mais c&#8217;est chômage technique en vue.</p>
<p>C&#8217;est con, j&#8217;aurais bien aimer tester la réalité augmenté sur iphone grâce à <a rel="nofollow" href="http://code.google.com/p/iphonearkit/" target="_blank">http://code.google.com/p/iphonearkit</a>. L&#8217;avez vous tester cette libraire vous ? Mais bon, je n&#8217;ai pas d&#8217;iphone 3GS non plus. D&#8217;ailleurs si vous avez un mac, un iphone 3GS que vous voulez me donner, y a pas de souci je prend :p</p>
<p><strong>Petite annonce iphone : </strong>Je suis à la recherche de dev iphone sur Lyon, débutant ou confirmé. N&#8217;hesitez pas à vous signaler par mail, je ne mord pas.</p>
<p>Par contre, pour ceux qui viennent pour du <strong><a class="zem_slink" title="PHP" rel="homepage" href="http://php.net/">PHP</a> et pour <a class="zem_slink" title="Symfony" rel="homepage" href="http://www.symfony-project.org/">Symfony</a> </strong>vont être content. Mon nouveau job m&#8217;en fera faire 8h par jour, je parie que je vais découvrir pleins de trucs que je posterais sur ce blog. :p</p>
<p><strong>Adieu objective-c, welcome PHP</strong>. (La tendance est de faire l&#8217;inverse, mais <a href="http://www.oni-ecchi.info/blog/tag/moi" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec moi">moi</a> je ne suis pas comme les autres ;p)</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/pixy.gif?x-id=b86059c6-fcb8-4624-aed9-8f314c839d9b" alt="" /><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://www.oni-ecchi.info/blog/guillaume-chave/retour-de-vacances.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Débuter sur le développement iPhone</title>
		<link>http://www.oni-ecchi.info/blog/iphone/debuter-sur-le-developpement-iphone.html</link>
		<comments>http://www.oni-ecchi.info/blog/iphone/debuter-sur-le-developpement-iphone.html#comments</comments>
		<pubDate>Thu, 23 Jul 2009 07:49:07 +0000</pubDate>
		<dc:creator>Guillaume chave</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[tutoriel]]></category>

		<guid isPermaLink="false">http://www.oni-ecchi.info/blog/?p=428</guid>
		<description><![CDATA[Salut, Il m&#8217;est arrivé plusieurs fois qu&#8217;on me demande ce qu&#8217;il faut pour bien débuter sur iPhone. La question est simple, la réponse un peu moins. Je vais commencer par le plus simple, le matériel. Matériel : un Mac intel. Désolé mais vos vieux mac à la cave ne marcheront pas. un iPhone de test. [...]]]></description>
			<content:encoded><![CDATA[<p>Salut,<br />
Il m&#8217;est arrivé plusieurs fois qu&#8217;on me demande ce qu&#8217;il faut pour bien débuter sur <a class="zem_slink" title="iPhone" rel="homepage" href="http://www.apple.com/iphone">iPhone</a>. La question est simple, la réponse un peu moins. Je vais commencer par le plus simple, le matériel.</p>
<h3>Matériel :</h3>
<ul>
<li><strong>un Mac intel</strong>. Désolé mais vos vieux mac à la cave ne marcheront pas.</li>
<li>un <strong><a href="http://www.oni-ecchi.info/blog/tag/iphone" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec iPhone">iPhone</a> de test</strong>. Le simulateur ne suffit pas.</li>
<li>une<strong> licence de développeur Apple</strong>. (Pas bien cher, 70€ je crois ..). Ceux qui disent  &laquo;&nbsp;Mais <a href="http://www.oni-ecchi.info/blog/tag/moi" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec moi">moi</a> je jailbreak j&#8217;envoie mes appli en SSH et fuck Apple&nbsp;&raquo; je leur répond &laquo;&nbsp;Vous vous faites bien chier.&nbsp;&raquo; Et les solutions pour auto signer son code pour l&#8217;envoyer &laquo;&nbsp;comme en vrai&nbsp;&raquo; c&#8217;est pas trop la joie (faut refaire les manips pour chaque projets ..)</li>
</ul>
<p>Sinon pour développer sur PC (windows notamment) sachez qu&#8217;on peut compiler des applis et se les envoyer en SSH etc. C&#8217;est faisable, mais alors quel perte de temps et vous verrez dans la suite de l&#8217;article qu&#8217;on y gagne pas tant que ça.</p>
<h3>Logiciels :</h3>
<ul>
<li><strong>Xcode </strong>le seul et unique <a class="zem_slink" title="Integrated development environment" rel="nofollow" href="http://en.wikipedia.org/wiki/Integrated_development_environment">IDE</a> sympathique. Il auto-complète un peu, permet de compiler directement sur le téléphone sans prise de tête, fourni un debugger pas à pas.</li>
<li><strong><a class="zem_slink" title="Interface Builder" rel="wikipedia" href="http://en.wikipedia.org/wiki/Interface_Builder">Interface Builder</a></strong>. Ça c&#8217;est le truc tape à l&#8217;oeil  qu&#8217;Apple met en avant. C&#8217;est pour construire les écrans et relier les éléments graphiques à leurs représentations &laquo;&nbsp;code&nbsp;&raquo;. C&#8217;est super pratique et beaucoup plus ergonomique que de le faire sur <a class="zem_slink" title="Android" rel="homepage" href="http://code.google.com/android/">Android</a> :
<pre>// Lie les champs graphiques à des champs codes
EditText login = (EditText) findViewById(R.id.login);</pre>
</li>
<li><strong>Instruments</strong>. Super pratique pour voir l&#8217;état en temps réel de l&#8217;iphone : consommation CPU, RAM, allocations d&#8217;objets etc. C&#8217;est avec ce genre d&#8217;outils que tu te dis &laquo;&nbsp;en fait je ne sais pas coder léger&nbsp;&raquo;</li>
</ul>
<p>Donc on voit bien que même s&#8217;il existe des solutions pour compiler sur PC, les &laquo;&nbsp;<a rel="nofollow" href="toolchain iphone" target="_blank">toolchain iphone</a>&nbsp;&raquo; c&#8217;est quand même dommage de se séparer de ces logiciels. Encore que pour Xcode eclipse doit pouvoir suffir, les deux autres logiciels n&#8217;ont pas l&#8217;air d&#8217;avoir d&#8217;équivalent.</p>
<p>Et puis la finalité de développer sur iPhone c&#8217;est bien d&#8217;avoir son quart d&#8217;heure de gloire sur l&#8217;appStore non ? Alors autant commencer bien et dans la légalité. Car si Apple découvre que vous n&#8217;avez pas utilisé ses outils, que votre appli est dispo en jailbreak etc .. ben c&#8217;est foutu après.</p>
<h3>Langage de programmation</h3>
<p>Je suis passé par 3 phases quand j&#8217;ai commencé à programmer en <strong>objective-c</strong>.</p>
<ul>
<li>Déroutant au début (retain une variable ? Kesako ?)</li>
<li>a l&#8217;air d&#8217;avoir des mécanismes complexes (le parsage d&#8217;XML est chelou quand on vient du web php/as3 etc)</li>
<li>Pratique et puissant quand on comprend les mécanismes par <a class="shal" href=" http://www.oni-ecchi.info/blog/iphone/iphone-delegate.html" title=" iPhone & Delegate">delegate</a>, que l&#8217;on joue avec les threads, que l&#8217;on crée ses propres classes outils (comme pour ma classe de <a class="shal" href=" http://www.oni-ecchi.info/blog/iphone/iphone-requete-http.html" title=" iPhone & Requete HTTP">requete http</a>)</li>
</ul>
<p>Mais comment apprendre ce langage ? la réponse est simple : dans la documentation.</p>
<h3>Documentation et <a href="http://www.oni-ecchi.info/blog/tag/tutoriel" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec tutoriel">Tutoriel</a></h3>
<p>La documentation et les guides Apple sont bien pratiques pour appréhender le langage et les mécanismes.</p>
<p>Cependant pour appréhender Interface Builder et sa relation avec le code c&#8217;est pas trop ça. Je conseille les tutos d<a rel="nofollow" href="http://ipup.fr/tutoriels.php" target="_blank">&#8216;ipup.fr</a> qui ont pas mal d&#8217;images et surtout que c&#8217;est français. </p>
<p>Sinon pour plus de liens, je vous conseille toujours les liens de mon précédent article &laquo;&nbsp;<a class="shal" href=" http://www.oni-ecchi.info/blog/iphone/creer-des-applications-iphone.html" title=" Créer des applications Iphone">créer des applications iphone</a>&nbsp;&raquo; et mon flux delicious :</p>
<p><cite class="aligncenter">ps : Si vous voulez suivre mes « découvertes » iphone,  mon flux delicious est constamment mis à jour ! <a href="http://delicious.com/onishinji/iphone">http://delicious.com/onishinji/iphone</a></cite></p>
]]></content:encoded>
			<wfw:commentRss>http://www.oni-ecchi.info/blog/iphone/debuter-sur-le-developpement-iphone.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>iPhone &amp; NSTimer</title>
		<link>http://www.oni-ecchi.info/blog/iphone/iphone-nstimer.html</link>
		<comments>http://www.oni-ecchi.info/blog/iphone/iphone-nstimer.html#comments</comments>
		<pubDate>Fri, 17 Jul 2009 09:27:00 +0000</pubDate>
		<dc:creator>Guillaume chave</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[tutoriel]]></category>

		<guid isPermaLink="false">http://www.oni-ecchi.info/blog/?p=414</guid>
		<description><![CDATA[Salut, Les NSTimers sont bien cool et en général ça ne pose aucun souci à les utiliser. J&#8217;ai bien dit en général. J&#8217;ai eu un souci avec ce matin&#8230;vraiment étrange. Sur un projet, j&#8217;en utilise un pour déclencher une méthode dans XX secondes une fois seulement. Ça marche impeccable. Sur un nouveau projet, je réutilise [...]]]></description>
			<content:encoded><![CDATA[<p>Salut,</p>
<p>Les NSTimers sont bien cool et en général ça ne pose aucun souci à les utiliser. J&#8217;ai bien dit en général. J&#8217;ai eu un souci avec ce matin&#8230;vraiment étrange.</p>
<p>Sur un projet, j&#8217;en utilise un pour déclencher une méthode dans XX secondes une fois seulement. Ça marche impeccable. Sur un nouveau projet, je réutilise le même mais en faisant varier un paramètre &laquo;&nbsp;repeats&nbsp;&raquo; à YES. Et bien sur, ça ne marchait plus.</p>
<p>Voici un timer qui déclenche une méthode une seule fois :</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p414code4'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4144"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code" id="p414code4"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>blabla
<span style="color: #009900;">&#123;</span>
	<span style="color: #009900;">&#91;</span>NSTimer scheduledTimerWithTimeInterval<span style="color: #339933;">:</span><span style="color:#800080;">10.0</span> target<span style="color: #339933;">:</span>self selector<span style="color: #339933;">:</span>@selector<span style="color: #009900;">&#40;</span>test<span style="color: #339933;">:</span><span style="color: #009900;">&#41;</span> userInfo<span style="color: #339933;">:</span>nil repeats<span style="color: #339933;">:</span>NO<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>test<span style="color: #339933;">:</span><span style="color: #009900;">&#40;</span>NSTimer<span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>timer
<span style="color: #009900;">&#123;</span>
	NSLog<span style="color: #009900;">&#40;</span>@<span style="color: #ff0000;">&quot;je suis appelé 1 fois&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Un timer qui se déclenche une méthode en boucle, techniquement il faudrait juste dire &laquo;&nbsp;repeats:YES&nbsp;&raquo; mais ca n&#8217;a pas marché dans mon cas. Le timer n&#8217;était jamais &laquo;&nbsp;fired&nbsp;&raquo; :p (je m&#8217;essaie à l&#8217;anglais)</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p414code5'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4145"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code" id="p414code5"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>blabla
<span style="color: #009900;">&#123;</span>
	<span style="color: #009900;">&#91;</span>NSTimer scheduledTimerWithTimeInterval<span style="color: #339933;">:</span><span style="color:#800080;">10.0</span> target<span style="color: #339933;">:</span>self selector<span style="color: #339933;">:</span>@selector<span style="color: #009900;">&#40;</span>test<span style="color: #339933;">:</span><span style="color: #009900;">&#41;</span> userInfo<span style="color: #339933;">:</span>nil repeats<span style="color: #339933;">:</span>YES<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>test<span style="color: #339933;">:</span><span style="color: #009900;">&#40;</span>NSTimer<span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>timer
<span style="color: #009900;">&#123;</span>
	NSLog<span style="color: #009900;">&#40;</span>@<span style="color: #ff0000;">&quot;je suis appelé en boucle c'est la fête.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Donc voici ce que j&#8217;ai utilisé pour que ça marche. J&#8217;ai forcé le démarrage du timer en boucle.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p414code6'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4146"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code" id="p414code6"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>blabla
<span style="color: #009900;">&#123;</span>
	NSTimer <span style="color: #339933;">*</span> timer <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>NSTimer timerWithTimeInterval<span style="color: #339933;">:</span> <span style="color: #0000dd;">1</span> target<span style="color: #339933;">:</span> self selector<span style="color: #339933;">:</span> @selector<span style="color: #009900;">&#40;</span>test<span style="color: #339933;">:</span><span style="color: #009900;">&#41;</span> userInfo<span style="color: #339933;">:</span> nil repeats<span style="color: #339933;">:</span> YES<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>NSRunLoop mainRunLoop<span style="color: #009900;">&#93;</span> addTimer<span style="color: #339933;">:</span> timer forMode<span style="color: #339933;">:</span> NSDefaultRunLoopMode<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>test<span style="color: #339933;">:</span><span style="color: #009900;">&#40;</span>NSTimer<span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>timer
<span style="color: #009900;">&#123;</span>
	NSLog<span style="color: #009900;">&#40;</span>@<span style="color: #ff0000;">&quot;je suis appelé en boucle c'est la fête.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Voilà voilà</p>
]]></content:encoded>
			<wfw:commentRss>http://www.oni-ecchi.info/blog/iphone/iphone-nstimer.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone &amp; Trucs et Astuces</title>
		<link>http://www.oni-ecchi.info/blog/iphone/iphone-trucs-et-astuces.html</link>
		<comments>http://www.oni-ecchi.info/blog/iphone/iphone-trucs-et-astuces.html#comments</comments>
		<pubDate>Tue, 14 Jul 2009 09:46:53 +0000</pubDate>
		<dc:creator>Guillaume chave</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[astuces]]></category>
		<category><![CDATA[delegate]]></category>
		<category><![CDATA[navigation]]></category>
		<category><![CDATA[tutoriel]]></category>

		<guid isPermaLink="false">http://www.oni-ecchi.info/blog/?p=370</guid>
		<description><![CDATA[Bonjour tout le monde, encore de l&#8217;iphone .. et ouais j&#8217;aime bien faire des petits exemples :p Cette fois ci à la demande non général de Sébastien H. voici quelques éléments de navigation que j&#8217;utilise dans mes applications.  Donc voici ce qu&#8217;il y a dans cet exemple : Comment créer et utiliser les préférences utilisateurs [...]]]></description>
			<content:encoded><![CDATA[<p>Bonjour tout le monde, encore de l&#8217;<a href="http://www.oni-ecchi.info/blog/tag/iphone" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec iPhone">iphone</a> .. et ouais j&#8217;aime bien faire des petits exemples :p</p>
<p>Cette fois ci à la demande non général de Sébastien H. voici quelques éléments de <a href="http://www.oni-ecchi.info/blog/tag/navigation" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec navigation">navigation</a> que j&#8217;utilise dans mes applications.  Donc voici ce qu&#8217;il y a dans cet exemple :</p>
<ul>
<li>Comment créer et utiliser les préférences utilisateurs à travers l&#8217;objet NSUserDefaults et le fichier settings.bundle :p</li>
<li>Comment créer une vue modal. Vous savez ce genre d&#8217;écrans qui arrivent par le bas de l&#8217;application et qui repartent ensuite.</li>
<li>Je refait aussi un petit rappel sur les <a class="shal" href=" http://www.oni-ecchi.info/blog/iphone/iphone-delegate.html" title=" iPhone & Delegate">delegate iphone</a> pour la vue modal.</li>
<li>Comment créer et utiliser le fameux menu d&#8217;actions à la façon safari pour permettre de fournir des boutons qui arrivent aussi par le bas de l&#8217;application (UIActionSheet)</li>
<li>Comment ouvrir d&#8217;autres applications installées sur l&#8217;iphone grâce à la méthode [UIApplication sharedApplication] :p</li>
</ul>
<p>On m&#8217;a dit qu&#8217;il manquait un peu d&#8217;images, voici des screenshoots de l&#8217;application d&#8217;exemple :</p>
<p><img src="http://www.oni-ecchi.info/blog/wp-content/uploads/2009/07/Image-1.png" alt="" width="209" height="315" /><img src="http://www.oni-ecchi.info/blog/wp-content/uploads/2009/07/Image-2.png" alt="" width="209" height="315" /></p>
<p>Le design est assez simple ;p</p>
<p><cite>Et n&#8217;oubliez pas de télécharger <a rel="attachment wp-att-378" href="http://www.oni-ecchi.info/blog/iphone/iphone-trucs-et-astuces.html/attachment/exemple-navigation">le projet Xcode de cet exemple</a></cite></p>
]]></content:encoded>
			<wfw:commentRss>http://www.oni-ecchi.info/blog/iphone/iphone-trucs-et-astuces.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone &amp; Requete HTTP</title>
		<link>http://www.oni-ecchi.info/blog/iphone/iphone-requete-http.html</link>
		<comments>http://www.oni-ecchi.info/blog/iphone/iphone-requete-http.html#comments</comments>
		<pubDate>Thu, 09 Jul 2009 11:15:45 +0000</pubDate>
		<dc:creator>Guillaume chave</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[astuces]]></category>
		<category><![CDATA[delegate]]></category>
		<category><![CDATA[nsurlrequest]]></category>
		<category><![CDATA[requete]]></category>
		<category><![CDATA[tutoriel]]></category>

		<guid isPermaLink="false">http://www.oni-ecchi.info/blog/?p=345</guid>
		<description><![CDATA[Yop all, A la demande général de Fabrice Bernhard, voici une classe que j&#8217;ai faite pour me simplifier la vie quand je dois faire une requête HTTP. Vous me direz &#171;&#160;pas besoin blabla&#160;&#187;, mais cette classe gère l&#8217;envoie d&#8217;images, de sons en plus de simple paramètres POST classique. Vous faites moins les malins hein :) [...]]]></description>
			<content:encoded><![CDATA[<p>Yop all,</p>
<p>A la demande général de Fabrice Bernhard, voici une classe que j&#8217;ai faite pour me simplifier la vie quand je dois faire une requête <a class="zem_slink" title="Hypertext Transfer Protocol" rel="wikipedia" href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol">HTTP</a>. Vous me direz &laquo;&nbsp;pas besoin blabla&nbsp;&raquo;, mais cette classe gère l&#8217;envoie d&#8217;images, de sons en plus de simple paramètres POST classique. Vous faites moins les malins hein :) Et si je vous dit qu&#8217;elle gère aussi si la requête doit être fait en mode synchrone ou asynchrone hein ? Ça t&#8217;en bouche un coin ?</p>
<p>Bah en fait elle est très simple, j&#8217;ai juste joué au légo avec les classes <a class="zem_slink" title="Apple" rel="homepage" href="http://www.apple.com">Apple</a>, mais c&#8217;est un lego qui me sert pas mal.</p>
<p>Voici un exemple d&#8217;utilisation, ce code est tiré de l&#8217;exemple que j&#8217;ai fait pour vous, disponible en téléchargement :</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p345code9'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3459"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
</pre></td><td class="code" id="p345code9"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span>IBAction<span style="color: #009900;">&#41;</span> send
<span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">// Crée la requete en mode asynchrone</span>
HttpRequest <span style="color: #339933;">*</span>masuperRequete <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>HttpRequest alloc<span style="color: #009900;">&#93;</span> initHttpRequest<span style="color: #339933;">:</span>formUrlAsk.<span style="color: #202020;">text</span> isSynchronous<span style="color: #339933;">:</span><span style="color: #000000; font-weight: bold;">false</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Ajoute un parametre POST['cleParam'];</span>
<span style="color: #009900;">&#91;</span>masuperRequete addParam<span style="color: #339933;">:</span>@<span style="color: #ff0000;">&quot;cleParam&quot;</span> valeurs<span style="color: #339933;">:</span>formParam.<span style="color: #202020;">text</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Ajoute un fichier Image. Les parametres seront sous la forme file1, file2, file3 .. etc</span>
<span style="color: #009900;">&#91;</span>masuperRequete addImage<span style="color: #339933;">:</span>imageTmp.<span style="color: #202020;">image</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// ajoute un son</span>
<span style="color: #666666; font-style: italic;">// On doit recuperer les données du son sous la forme d'un NSDATA</span>
<span style="color: #666666; font-style: italic;">// Ici le son est distant .. on le recupère donc avec the super classe en mode syncrhone</span>
HttpRequest <span style="color: #339933;">*</span>sousReq <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>HttpRequest alloc<span style="color: #009900;">&#93;</span> initHttpRequest<span style="color: #339933;">:</span>formUrlSound.<span style="color: #202020;">text</span> isSynchronous<span style="color: #339933;">:</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
NSData <span style="color: #339933;">*</span> dataSound <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>sousReq send<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Recupere le nom du son</span>
NSArray <span style="color: #339933;">*</span> mots <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>formUrlSound.<span style="color: #202020;">text</span> componentsSeparatedByString<span style="color: #339933;">:</span>@<span style="color: #ff0000;">&quot;/&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
NSString <span style="color: #339933;">*</span>nameoffile <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>mots lastObject<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#91;</span>masuperRequete addSound<span style="color: #339933;">:</span>dataSound nameoffile<span style="color: #339933;">:</span>nameoffile nameinform<span style="color: #339933;">:</span>@<span style="color: #ff0000;">&quot;mamusique&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Envoie la superRequete</span>
masuperRequete.<span style="color: #202020;">delegate</span> <span style="color: #339933;">=</span> self<span style="color: #339933;">;</span>
<span style="color: #009900;">&#91;</span>masuperRequete send<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// y a un delegate pour recup le retour de la requete en mode asynchrone</span>
<span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>downloadFinish<span style="color: #339933;">:</span><span style="color: #009900;">&#40;</span>NSMutableData <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>data
<span style="color: #009900;">&#123;</span>
NSLog<span style="color: #009900;">&#40;</span>@<span style="color: #ff0000;">&quot;telechargement termine&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Maintenant voici le code source complet de l&#8217;exemple</p>
<p><cite><a rel="attachment wp-att-348" href="http://www.oni-ecchi.info/blog/iphone/iphone-requete-http.html/attachment/exemple-post">Exemple de la classe HTTPRequest</a></cite></p>
<p>Pour récupérer les données par la suite, rien de plus simple tout est dans $_POST et $_FILES.</p>
<p><strong>maj</strong> : voilà le code source du fichier php que j&#8217;ai utilisé :</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p345code10'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p34510"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
</pre></td><td class="code" id="p345code10"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000088;">$content_dir</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'upload/'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">||</span> <a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
&nbsp;
&nbsp;
&nbsp;
&nbsp;
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;variable POST : <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$cle</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$val</span><span style="color: #009900;">&#41;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$cle</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' =&gt; '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$val</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'monson'</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>
			<span style="color: #000088;">$test</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/base64_decode"><span style="color: #990000;">base64_decode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'monson'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/fopen"><span style="color: #990000;">fopen</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;upload/son.caf&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;w+&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<a href="http://www.php.net/fwrite"><span style="color: #990000;">fwrite</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span><span style="color: #000088;">$test</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			fclode<span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;variable FILES : <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$cle</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$image</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
&nbsp;
			<span style="color: #000088;">$tmp_file</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$image</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tmp_name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tmp_file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
&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_uploaded_file"><span style="color: #990000;">is_uploaded_file</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tmp_file</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
				<span style="color: #009900;">&#123;</span>
					<a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Le fichier est introuvable&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
&nbsp;
				<span style="color: #666666; font-style: italic;">// on vérifie maintenant l'extension</span>
				<span style="color: #000088;">$type_file</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$image</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><a href="http://www.php.net/strstr"><span style="color: #990000;">strstr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$type_file</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'jpg'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span><span style="color: #666666; font-style: italic;">#038;&amp;#038; !strstr($type_file, 'jpeg') &amp;#038;&amp;#038; !strstr($type_file, 'bmp') &amp;#038;&amp;#038; !strstr($type_file, 'png') &amp;#038;&amp;#038; !strstr($type_file, 'gif') )
</span>				<span style="color: #009900;">&#123;</span>
					<span style="color: #666666; font-style: italic;">//exit(&quot;Le fichier n'est pas une image&quot;);</span>
				<span style="color: #009900;">&#125;</span>
&nbsp;
				<span style="color: #666666; font-style: italic;">// on copie le fichier dans le dossier de destination</span>
				<span style="color: #000088;">$name_file</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$image</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$cle</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; =&gt; &quot;</span> <span style="color: #339933;">.</span><span style="color: #000088;">$name_file</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; reçu <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><a href="http://www.php.net/move_uploaded_file"><span style="color: #990000;">move_uploaded_file</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tmp_file</span><span style="color: #339933;">,</span> <span style="color: #000088;">$content_dir</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$name_file</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
				<span style="color: #009900;">&#123;</span>
					<a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Impossible de copier le fichier dans <span style="color: #006699; font-weight: bold;">$content_dir</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
&nbsp;
			<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span>
<span style="color: #009900;">&#123;</span>
	 <span style="color: #000088;">$rep</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;upload/&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$dir</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/opendir"><span style="color: #990000;">opendir</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$rep</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$f</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/readdir"><span style="color: #990000;">readdir</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  	 <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/is_file"><span style="color: #990000;">is_file</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$rep</span><span style="color: #339933;">.</span><span style="color: #000088;">$f</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;li&gt;Nom : &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$f</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;a href=&quot;upload/'</span><span style="color: #339933;">.</span><span style="color: #000088;">$f</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt; DL &lt;/a&gt;'</span><span style="color: #339933;">;</span>
      		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;li&gt;Taille : &quot;</span><span style="color: #339933;">.</span><a href="http://www.php.net/filesize"><span style="color: #990000;">filesize</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$rep</span><span style="color: #339933;">.</span><span style="color: #000088;">$f</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; octets&quot;</span><span style="color: #339933;">;</span>
      		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;br /&gt;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
   		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
 <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Précisons quand même que ma classe est en alpha, certaines fonctionnalités ne sont pas implémentés. Je pense notamment à la gestion des erreurs, le <a href="http://www.oni-ecchi.info/blog/tag/delegate" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec delegate">delegate</a> qui donne le taux de progression de l&#8217;upload etc. Je vous laisse le faire :p</p>
<p>Enjoy !</p>
<div class="zemanta-img zemanta-action-dragged" style="margin: 1em; display: block;">
<div class="wp-caption alignleft" style="width: 210px"><a href="http://www.crunchbase.com/company/apple"><img title="Image representing Apple as depicted in CrunchBase" src="http://www.crunchbase.com/assets/images/resized/0001/0923/10923v1-max-450x450.png" alt="Image representing Apple as depicted in CrunchBase" width="200" height="122" /></a><p class="wp-caption-text">Image via CrunchBase</p></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.oni-ecchi.info/blog/iphone/iphone-requete-http.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>iPhone &amp; Delegate</title>
		<link>http://www.oni-ecchi.info/blog/iphone/iphone-delegate.html</link>
		<comments>http://www.oni-ecchi.info/blog/iphone/iphone-delegate.html#comments</comments>
		<pubDate>Mon, 06 Apr 2009 16:21:10 +0000</pubDate>
		<dc:creator>Guillaume chave</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[classe]]></category>
		<category><![CDATA[delegate]]></category>
		<category><![CDATA[objective c]]></category>
		<category><![CDATA[protocol]]></category>

		<guid isPermaLink="false">http://www.oni-ecchi.info/blog/?p=323</guid>
		<description><![CDATA[Bonjour, Voici juste un petit &#171;&#160;How to&#160;&#187; pour comprendre et jour avec les delegate sur cocoa. Admettons vous avez une classe &#171;&#160;ListingController&#160;&#187; qui hérite d&#8217;une UIViewController qui gère une liste d&#8217;élément et que vous avez une classe &#171;&#160;DetailController&#160;&#187; qui hérite aussi d&#8217;une UIViewController mais qui donne le detail de l&#8217;élément cliqué. Vous voulez que lorsqu&#8217;on [...]]]></description>
			<content:encoded><![CDATA[<p>Bonjour,</p>
<p>Voici juste un petit &laquo;&nbsp;How to&nbsp;&raquo; pour comprendre et jour avec les <a href="http://www.oni-ecchi.info/blog/tag/delegate" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec delegate">delegate</a> sur cocoa.</p>
<p>Admettons vous avez une classe &laquo;&nbsp;ListingController&nbsp;&raquo; qui hérite d&#8217;une UIViewController qui gère une liste d&#8217;élément et que vous avez une classe &laquo;&nbsp;DetailController&nbsp;&raquo; qui hérite aussi d&#8217;une UIViewController mais qui donne le detail de l&#8217;élément cliqué.</p>
<p>Vous voulez que lorsqu&#8217;on click sur un bouton posé sur la vue Détail revenir à la liste principal, puis la recharger. Revenir à la vue principal est assez simple il suffit de crée une méthode &laquo;&nbsp;IBAction&nbsp;&raquo; dans le controller Detail, liée le bouton à cette méthode via Interface builder puis écrire  :</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p323code19'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p32319"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p323code19"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span>IBAction<span style="color: #009900;">&#41;</span>goHome <span style="color: #009900;">&#123;</span>
<span style="color: #009900;">&#91;</span>self.<span style="color: #202020;">view</span> removeFromSuperview<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Et le tour est joué mais bon, la liste n&#8217;est pas rechargé pour autant et il n&#8217;y a pas eu la levé d&#8217;un évènement pour la classe &laquo;&nbsp;Liste&nbsp;&raquo;. C&#8217;est là que les delegate peuvent nous être utile.</p>
<blockquote><p>Le principe est de définir des méthodes sur la classe de Detail puis les appeller/utiliser lors du click mais c&#8217;est la classe Liste qui les implémentera effectivement.</p>
</blockquote>
<p>Voici la marche à suivre :</p>
<ol>
<li>Dans la classe Detail : Définir une ou plusieurs méthodes dite &laquo;&nbsp;delegate&nbsp;&raquo; qui devront être implémenter. On appelle ce genre de déclaration un &laquo;&nbsp;protocole&nbsp;&raquo;.</li>
<li>Dans la classe Detail : Définir une propriété de classe de type &laquo;&nbsp;id&nbsp;&raquo; qui utilise le protocole. Cette propriété représente un lien vers la classe &laquo;&nbsp;parente&nbsp;&raquo; qui implémentera effectivement notre protocole.</li>
<li>Dans la classe Detail : Appeller lors du click les méthodes &laquo;&nbsp;delegate&nbsp;&raquo; sur notre protocole.</li>
<li>Dans la classe Liste : Implémenter les méthodes delegate dans notre classe &laquo;&nbsp;parente&nbsp;&raquo;.</li>
</ol>
<h3>Etape 1 :</h3>
<p>Dans le fichier &laquo;&nbsp;DetailController.h&nbsp;&raquo;, <strong>juste après</strong> les #import <strong>et avant </strong>@interface DetailController : UIViewController { } :</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p323code20'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p32320"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p323code20"><pre class="c" style="font-family:monospace;">@protocol DetailControllerDelegate
@required
<span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>RetourListe<span style="color: #339933;">;</span>
@end</pre></td></tr></table></div>

<h3>Etape 2 :</h3>
<p>Toujours dans le fichier &laquo;&nbsp;DetailController.h&nbsp;&raquo;, après &laquo;&nbsp;@interface DetailController : UIViewController {&nbsp;&raquo; nous définissons une propriété que nous appellerons &laquo;&nbsp;delegate&nbsp;&raquo; :</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p323code21'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p32321"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p323code21"><pre class="c" style="font-family:monospace;">id delegate<span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>puis après l&#8217;accolade définissant l&#8217;interface :</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p323code22'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p32322"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p323code22"><pre class="c" style="font-family:monospace;">@property <span style="color: #009900;">&#40;</span>nonatomic<span style="color: #339933;">,</span>assign<span style="color: #009900;">&#41;</span> id <span style="color: #339933;">&lt;</span> DetailControllerDelegate <span style="color: #339933;">&gt;</span> delegate<span style="color: #339933;">;</span>
&nbsp;
@end</pre></td></tr></table></div>

<p>Notre propriété &laquo;&nbsp;delegate&nbsp;&raquo; est de type &laquo;&nbsp;id&nbsp;&raquo; mais &laquo;&nbsp;implémente&nbsp;&raquo; le protocole précédement utilisé.</p>
<h3>Etape 3 :</h3>
<p>Nous avons définit une propriété dans le fichier &laquo;&nbsp;.h&nbsp;&raquo;, il faut maintenant s&#8217;en servir dans notre fichier &laquo;&nbsp;DetailController<strong>.m</strong>&nbsp;&raquo; :</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p323code23'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p32323"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code" id="p323code23"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#import &quot;DetailController.h&quot;</span>
@implementation DetailController
@synthesize delegate<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//synthetisé une propriété signifie que le sdk créera les getters/setters pour nous</span>
<span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span>IBAction<span style="color: #009900;">&#41;</span>goHome
<span style="color: #009900;">&#123;</span>
	NSLog<span style="color: #009900;">&#40;</span>@<span style="color: #ff0000;">&quot;Go home Liste&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#91;</span>self.<span style="color: #202020;">delegate</span> RetourListe<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// dispatch l'évènement à la classe parente.</span>
	<span style="color: #009900;">&#91;</span>self.<span style="color: #202020;">view</span> removeFromSuperview<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// supprime la vue courante</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>C&#8217;est fini pour notre classe Detail  ! Vous remarquerez qu&#8217;à aucun moment il n&#8217;y a de lien vers la classe &laquo;&nbsp;Liste&nbsp;&raquo;. Le couplage est donc très faible entre ces classes. Ce principe de couplage faible est assez puissant si on y réfléchi à deux fois vu que nos classes sont, de fait, totalement indépendantes vis à vis de leur &laquo;&nbsp;parent&nbsp;&raquo; (ou du contexte d&#8217;execution pour être plus bien parlant). Bon bref ça c&#8217;était le coup de pub raté pour la puissance du modèle objet.</p>
<h3>Etape 4</h3>
<p>Implémentons les méthodes ! Dans le fichier &laquo;&nbsp;ListingController.h&nbsp;&raquo; nous déclarons notre interface comme ceci :</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p323code24'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p32324"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p323code24"><pre class="c" style="font-family:monospace;">@interface ListingController <span style="color: #339933;">:</span> UIViewController <span style="color: #339933;">&lt;</span> DetailControllerDelegate <span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">// some code</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Et dans notre fichier &laquo;&nbsp;ListingController.m&nbsp;&raquo; il suffit d&#8217;implémenter la méthode &laquo;&nbsp;RetourListe&nbsp;&raquo;. Surtout, ne pas la déclarer dans l&#8217;interface (le fichier .h) sinon le programme se mélangera les pinceaux ! (Oui, vous utilisez deux méthodes avec le même nom ayant des portés différentes ..)</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p323code25'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p32325"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p323code25"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>RetourListe
<span style="color: #009900;">&#123;</span>
    NSLog<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;coucou&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">// some code</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><b>Edit</b> : Oups, erreur. On crée la méthode mais à un aucun moment on dit que notre classe Listing va implémenter les méthodes de detail hormis dans la déclaration (fichier.h). Il faut donc qu&#8217;à notre objet &laquo;&nbsp;DetailController&nbsp;&raquo;, juste après qu&#8217;il soit instanciée, au moment du click par exemple faire un :</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p323code26'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p32326"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p323code26"><pre class="c" style="font-family:monospace;">DetailController<span style="color: #339933;">*</span>myView <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>DetailControlleralloc<span style="color: #009900;">&#93;</span> initWithNibName<span style="color: #339933;">:</span>@<span style="color: #ff0000;">&quot;DetailView&quot;</span> bundle<span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span>NSBundle mainBundle<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
myView.<span style="color: #202020;">delegate</span> <span style="color: #339933;">=</span> self<span style="color: #339933;">;</span></pre></td></tr></table></div>

<p> On définit que c&#8217;est la classe Listing (self) va implémenter les méthodes delegate de détail.</p>
<p>Et voilà, normallement ça doit marcher.</p>
<p>Ce &laquo;&nbsp;How to&nbsp;&raquo; a été écrit à partir d&#8217;un projet personnel, je ne pourrais donc pas donnée des sources qui utilisent ce concept. A l&#8217;heure où j&#8217;écrit ce billet je n&#8217;ai pas de Mac à ma disposition.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.oni-ecchi.info/blog/iphone/iphone-delegate.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Android vs Iphone</title>
		<link>http://www.oni-ecchi.info/blog/android/android-vs-iphone.html</link>
		<comments>http://www.oni-ecchi.info/blog/android/android-vs-iphone.html#comments</comments>
		<pubDate>Thu, 02 Apr 2009 12:10:53 +0000</pubDate>
		<dc:creator>Guillaume chave</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[comparatif]]></category>

		<guid isPermaLink="false">http://www.oni-ecchi.info/blog/?p=316</guid>
		<description><![CDATA[Aujourd&#8217;hui, je dois créer une application Android pour un projet de cours. VDM. En effet, Android peut faire peur : tout est en java un simulateur horriblement moche une documentation light light pas d&#8217;outil &#171;&#160;friendly&#160;&#187; et fun pour faire des interfaces. Aucune vidéo &#171;&#160;qui pete sa race&#160;&#187; propulsé par le dieu de l&#8217;information Google à [...]]]></description>
			<content:encoded><![CDATA[<p>Aujourd&#8217;hui, je dois créer une application <a href="http://www.oni-ecchi.info/blog/tag/android" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec Android">Android</a> pour un projet de cours. VDM.</p>
<p>En effet, Android peut faire peur :</p>
<ul>
<li> tout est en java</li>
<li>un simulateur horriblement moche</li>
<li>une documentation light light</li>
<li>pas d&#8217;outil &laquo;&nbsp;friendly&nbsp;&raquo; et fun pour faire des interfaces. Aucune vidéo &laquo;&nbsp;qui pete sa race&nbsp;&raquo;</li>
<li> propulsé par le dieu de l&#8217;information Google à grand coup de millions de $</li>
</ul>
<p>Il est vrai que c&#8217;est rebutant à première vue et l&#8217;on peut penser que c&#8217;est un peu masochiste de developper sur Android. Mais de mon expérience &laquo;&nbsp;Iphonesque&nbsp;&raquo; je dirais que ça se vaut, voyez par vous même :</p>
<p><a href="http://www.oni-ecchi.info/blog/tag/iphone" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec iPhone">Iphone</a> me fait peur :</p>
<ul>
<li>tout est en Objective-C/C/C++ OMG</li>
<li>un simulateur esthétiquement jolie mais rien sous le capot</li>
<li>une documentation étouffante, y a des guides, des vidéos, des définitions de classes .. y en a trop à mon gout.</li>
<li>pas de génération de code comme avec eclipses, l&#8217;auto-completion mollassonne et pas franchement efficaces</li>
<li>propulsé par le dieu de la manipulation Apple et son cercle &laquo;&nbsp;VIP/expert&nbsp;&raquo; de m***</li>
</ul>
<p>Chacun ses gouts après, si l&#8217;on est plus &laquo;&nbsp;ça pete c&#8217;est beau ca suffit&nbsp;&raquo; je dirais que l&#8217;iphone est plus adaptés qu&#8217;android. A contrario on veut faire du code sympa Android c&#8217;est plus abordable.</p>
<p>Perso, <a href="http://www.oni-ecchi.info/blog/tag/moi" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec moi">moi</a> le code ça me botte plus qu&#8217;une jolie interface. Je préfère donc Android pour la philosophie qu&#8217;il a derrière. C&#8217;est en grande partie open-source, on peut avoir accès aux codes des autres, aux milliers de librairie JAVA qui existent plus simplement.</p>
<p>Ces prochains jours j&#8217;essaierais de faire des billets sur des exemples de de programmes sur android. Au programme : hello world, la gestions des boutons et menus, passez d&#8217;un écran à l&#8217;autre, faire des requetes Web, parser de l&#8217;XML, jouer avec les listes et la personnalisation des cellules.</p>
<p>Bonne journée et à bientôt pour une session Android :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.oni-ecchi.info/blog/android/android-vs-iphone.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

