<?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>FruityFred &#187; Développement</title>
	<atom:link href="http://www.fruityfred.com/category/dev/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fruityfred.com</link>
	<description>Blog d&#039;un développeur (web &#38;&#38; Mac) qui aime bouger et la bonne cuisine</description>
	<lastBuildDate>Wed, 04 Jan 2012 20:58:50 +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>Présentation de Xcode 4</title>
		<link>http://www.fruityfred.com/2011/08/01/presentation-xcode-4/</link>
		<comments>http://www.fruityfred.com/2011/08/01/presentation-xcode-4/#comments</comments>
		<pubDate>Mon, 01 Aug 2011 21:43:39 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[Développement]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Interface Builder]]></category>
		<category><![CDATA[screenshot]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://www.fruityfred.com/?p=5806</guid>
		<description><![CDATA[Depuis très longtemps, pour développer des applications Mac, il fallait utiliser deux outils distincts : Interface Builder et Xcode. Le premier, comme son nom l&#8217;indique très bien, permet de construire des interfaces graphiques : c&#8217;est un outil visuel, dans lequel on crée des interfaces en y plaçant des objets par glisser/déposer et en définissant les [...]]]></description>
			<content:encoded><![CDATA[<p>Depuis très longtemps, pour développer des applications Mac, il fallait utiliser deux outils distincts : <span xml:lang="en">Interface Builder</span> et <span xml:lang="en">Xcode</span>. Le premier, comme son nom l&#8217;indique très bien, permet de <strong>construire des interfaces graphiques</strong> : c&#8217;est un <strong>outil visuel</strong>, dans lequel on crée des interfaces en y plaçant des objets par <strong>glisser/déposer</strong> et en définissant les propriétés de ces objets. <span xml:lang="en">Xcode</span>, lui, c&#8217;est l&#8217;<strong>éditeur de code</strong>, principalement <strong>Objective-C</strong>, C et C++.</p>
<p><strong>Les deux outils étaient séparés</strong> et il fallait souvent faire des allers-retours entre les deux durant la phase de création de l&#8217;interface d&#8217;une application. Chacun de ces deux logiciels disposaient de plusieurs fenêtres, et il était assez facile de ne plus s&#8217;y retrouver.</p>
<p>Et puis l&#8217;<a href="http://www.apple.com/fr/iphone/" xml:lang="en" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/www.apple.com/fr/iphone/?referer=');">iPhone</a> est arrivé ! Et surtout l&#8217;<strong>App Store</strong>, qui permet à tout développeur de vendre son application, sur un <strong>fabuleux marché de plusieurs millions d&#8217;utilisateurs</strong>. Pour développer une application <a href="http://www.apple.com/fr/iphone/" xml:lang="en" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/www.apple.com/fr/iphone/?referer=');">iPhone</a>, on passait par les mêmes outils : <span xml:lang="en">Interface Builder</span> et <span xml:lang="en">Xcode</span>. Pour un développeur habitué à des outils comme <a href="http://www.eclipse.org" onclick="pageTracker._trackPageview('/outgoing/www.eclipse.org?referer=');">Eclipse</a> (ou autre Visual Machin-Truc), il faut avouer que la transition ne se faisait pas sans douleur&#8230;</p>
<p>Et puis <strong><span xml:lang="en">Xcode</span> 4</strong> est arrivé, sans son fidèle compagnon. Et pour cause : <strong><span xml:lang="en">Xcode</span> a complètement absorbé <span xml:lang="en">Interface Builder</span> !</strong> Les deux ne font plus qu&#8217;un. Apple a sans doute voulu rapprocher son outil de développement intégré (<a href="http://fr.wikipedia.org/wiki/Environnement_de_d%C3%A9veloppement_int%C3%A9gr%C3%A9" xml:lang="en" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/fr.wikipedia.org/wiki/Environnement_de_d_C3_A9veloppement_int_C3_A9gr_C3_A9?referer=');"><abbr title="Integrated Development Environment" xml:lang="en">IDE</abbr></a>) des autres outils pour faciliter la transition depuis d&#8217;autres environnements, et aussi pour <strong>attirer encore plus de développeurs</strong> sur sa plate-forme. Et je dois dire que ce changement me convient très bien :)</p>
<p>En attendant des tutoriels plus développés, je vous propose quelques <strong>captures d&#8217;écran annotées</strong> de ce nouveau <span xml:lang="en">Xcode</span> !</p>
<p><a href="http://www.fruityfred.com/wp-content/uploads/2011/08/xcode_editor_code.png" rel="lightbox[5806]"><img class="size-medium wp-image-5811 no-border alignnone" title="Xcode et l'éditeur de code" src="http://www.fruityfred.com/wp-content/uploads/2011/08/xcode_editor_code-300x197.png" alt="" width="300" height="197" /></a><a href="http://www.fruityfred.com/wp-content/uploads/2011/08/xcode_editor_ui.png" rel="lightbox[5806]"><img class="size-medium wp-image-5814 no-border alignnone" title="Xcode et l'intégration d'Interface Builder" src="http://www.fruityfred.com/wp-content/uploads/2011/08/xcode_editor_ui-300x197.png" alt="" width="300" height="197" /></a><a href="http://www.fruityfred.com/wp-content/uploads/2011/08/xcode_editor_ui_details.png" rel="lightbox[5806]"><img class="size-medium wp-image-5813 no-border alignnone" title="Xcode et le détail du contenu du fichier XIB" src="http://www.fruityfred.com/wp-content/uploads/2011/08/xcode_editor_ui_details-300x197.png" alt="" width="300" height="197" /></a><a href="http://www.fruityfred.com/wp-content/uploads/2011/08/xcode_editor_model.png" rel="lightbox[5806]"><img class="size-medium wp-image-5812 no-border alignnone" title="Xcode et l'éditeur de Model Core Data" src="http://www.fruityfred.com/wp-content/uploads/2011/08/xcode_editor_model-300x197.png" alt="" width="300" height="197" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fruityfred.com/2011/08/01/presentation-xcode-4/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>OnliGence : bientôt un nouveau produit tout droit sorti des GreenIvory&#8217;s labs</title>
		<link>http://www.fruityfred.com/2011/05/06/onligence-bientot-un-nouveau-produit-tout-droit-sorti-des-greenivorys-labs/</link>
		<comments>http://www.fruityfred.com/2011/05/06/onligence-bientot-un-nouveau-produit-tout-droit-sorti-des-greenivorys-labs/#comments</comments>
		<pubDate>Fri, 06 May 2011 07:17:16 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[Annonces]]></category>
		<category><![CDATA[Développement]]></category>
		<category><![CDATA[Événements]]></category>
		<category><![CDATA[Logiciels]]></category>
		<category><![CDATA[GreenIvory]]></category>
		<category><![CDATA[GWT]]></category>
		<category><![CDATA[outil]]></category>

		<guid isPermaLink="false">http://www.fruityfred.com/?p=4640</guid>
		<description><![CDATA[Je ne peux pas en dire plus pour l&#8217;instant, nous essayons de garder le secret sur ce que sera OnliGence. Mais je peux d&#8217;ores et déjà vous dire que ce sera un outil puissant et utile à tous ! Je fais partie de l&#8217;équipe qui le développe, pour la partie visible du produit (UI) et [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.fruityfred.com/wp-content/uploads/2011/05/OnliGence.jpeg" rel="lightbox[4640]"><img class="alignleft no-border size-full wp-image-4645" title="OnliGence" src="http://www.fruityfred.com/wp-content/uploads/2011/05/OnliGence.jpeg" alt="" width="180" height="180" /></a>Je ne peux pas en dire plus pour l&#8217;instant, nous essayons de garder le secret sur ce que sera <strong>OnliGence</strong>. Mais je peux d&#8217;ores et déjà vous dire que ce sera un <strong>outil puissant et utile à tous</strong> !</p>
<p>Je fais partie de l&#8217;équipe qui le développe, pour la partie visible du produit (UI) et je peux vous dire que je l&#8217;attends avec impatience ! Mais il reste encore quelques finitions à faire&#8230;</p>
<p>Pour les développeurs qui me lisent, voici quelques informations techniques qui pourront vous intéresser : l&#8217;interface graphique a été développée en <strong><a href="http://code.google.com/webtoolkit/" xml:lang="en" hreflang="en" onclick="pageTracker._trackPageview('/outgoing/code.google.com/webtoolkit/?referer=');"><abbr title="Google Web Toolkit" xml:lang="en">GWT</abbr></a></strong>, en utilisant activement les dernières évolutions comme <a href="http://code.google.com/intl/fr-FR/webtoolkit/doc/latest/DevGuideMvpActivitiesAndPlaces.html" onclick="pageTracker._trackPageview('/outgoing/code.google.com/intl/fr-FR/webtoolkit/doc/latest/DevGuideMvpActivitiesAndPlaces.html?referer=');">MVP, Activity &amp; Place</a>, les <a href="http://code.google.com/intl/fr-FR/webtoolkit/doc/latest/DevGuideClientBundle.html" onclick="pageTracker._trackPageview('/outgoing/code.google.com/intl/fr-FR/webtoolkit/doc/latest/DevGuideClientBundle.html?referer=');">ClientBundle et autres CssResource</a>&#8230; On a mis le paquet pour faire un produit propre et joli (tant visuellement que dans le code).</p>
<p>En attendant, vous pourrez en découvrir davantage sur la <a href="https://www.facebook.com/OnliGence" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/OnliGence?referer=');">page Facebook d&#8217;OnliGence</a>&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fruityfred.com/2011/05/06/onligence-bientot-un-nouveau-produit-tout-droit-sorti-des-greenivorys-labs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mercurial : une alternative séduisante à Subversion</title>
		<link>http://www.fruityfred.com/2011/02/10/mercurial-une-alternative-seduisante-a-subversion/</link>
		<comments>http://www.fruityfred.com/2011/02/10/mercurial-une-alternative-seduisante-a-subversion/#comments</comments>
		<pubDate>Thu, 10 Feb 2011 14:11:37 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[Développement]]></category>
		<category><![CDATA[CVS]]></category>
		<category><![CDATA[SCM]]></category>
		<category><![CDATA[Subversion]]></category>

		<guid isPermaLink="false">http://www.fruityfred.com/?p=4097</guid>
		<description><![CDATA[Amis développeurs, cet article est pour vous ! Pour les non-développeurs, eh bien, je m&#8217;excuse, mais cet article risque fort de ne pas vous être d&#8217;une grande utilité (sans pour autant prétendre que mes autres articles le soient). Tout développeur a eu un jour affaire à un système de contrôle de code source (SCM). Du [...]]]></description>
			<content:encoded><![CDATA[<p>Amis développeurs, cet article est pour vous ! Pour les non-développeurs, eh bien, je m&#8217;excuse, mais cet article risque fort de ne pas vous être d&#8217;une grande utilité (sans pour autant prétendre que mes autres articles le soient).</p>
<p>Tout développeur a eu un jour affaire à un <strong>système de contrôle de code source (<abbr title="Source Code Management">SCM</abbr>)</strong>. Du moins, je lui souhaite. Parmi les plus connus et les plus répandus (je parle des SCM, pas des développeurs&#8230;), on trouve :</p>
<ul>
<li><strong><a href="http://fr.wikipedia.org/wiki/Concurrent_versions_system" xml:lang="en" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/fr.wikipedia.org/wiki/Concurrent_versions_system?referer=');"><abbr title="Concurrent Versions System" xml:lang="en">CVS</abbr></a></strong>, l&#8217;ancien, on se demande même s&#8217;il n&#8217;était pas là avant la Création,</li>
<li><strong>Subversion</strong> (ou <a href="http://subversion.tigris.org/" xml:lang="en" onclick="pageTracker._trackPageview('/outgoing/subversion.tigris.org/?referer=');"><abbr title="Subversion" xml:lang="en">SVN</abbr></a>), qu&#8217;on utilise quand on a franchi un pas de trop vers la folie à cause de <a href="http://fr.wikipedia.org/wiki/Concurrent_versions_system" xml:lang="en" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/fr.wikipedia.org/wiki/Concurrent_versions_system?referer=');"><abbr title="Concurrent Versions System" xml:lang="en">CVS</abbr></a>.</li>
</ul>
<p><strong>Mais si Subversion vous rend dingue, que vous reste-t-il ?</strong></p>
<p>Peut-être bien <strong><a href="http://mercurial.selenic.com/" onclick="pageTracker._trackPageview('/outgoing/mercurial.selenic.com/?referer=');">Mercurial</a></strong> ! Son ambition est simple : oubliez Subversion et ses problèmes, utilisez Mercurial et retrouvez le goût pour le développement logiciel ! Hum, bon, c&#8217;est prétentieux, certes, mais d&#8217;après la description que je viens d&#8217;en lire et les concepts utilisés, cela me semble tout à fait possible. J&#8217;ai identifié deux aspects particulièrement intéressants :</p>
<ul>
<li>Le <em>commit</em> se fait en deux phases :
<ol>
<li>Le développeur <em>commit</em> sur son <strong>repository local</strong> et peut ainsi profiter du système de versioning (et des <em>revert</em>, notamment), sans pour autant impacter le reste du monde.</li>
<li>Quand le code est stable, il <em>push</em> ce code sur le <strong>repository central</strong>.</li>
</ol>
</li>
<li>Mercurial stocke les changements (<em>changesets</em>) d&#8217;une manière intelligente et est ainsi capable d&#8217;effectuer de véritables <em>merge</em> sans conflits. Le branchage devient alors un véritable outil de production plutôt qu&#8217;une bête noire.</li>
</ul>
<p>Pour en savoir plus, je vous laisse lire cette <a hreflang="en" href="http://hginit.com/" onclick="pageTracker._trackPageview('/outgoing/hginit.com/?referer=');">très bonne introduction à Mercurial</a> (en anglais).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fruityfred.com/2011/02/10/mercurial-une-alternative-seduisante-a-subversion/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>eBALLution</title>
		<link>http://www.fruityfred.com/2009/12/08/eballution/</link>
		<comments>http://www.fruityfred.com/2009/12/08/eballution/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 23:37:32 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[Annonces]]></category>
		<category><![CDATA[Développement]]></category>
		<category><![CDATA[Logiciels]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[casse-brique]]></category>
		<category><![CDATA[évolution]]></category>
		<category><![CDATA[jeu vidéo]]></category>
		<category><![CDATA[OpenGL]]></category>

		<guid isPermaLink="false">http://www.glimpse-fr.org/?p=892</guid>
		<description><![CDATA[Cela fait déjà quelque temps que je développe un petit jeu vidéo pour Mac OS X, histoire d&#8217;apprendre quelques technologies telles que OpenGL, Cocoa… ça change de Java, HTML et CSS ! Le moteur est maintenant assez avancé pour que j&#8217;ose en parler. Le jeu s&#8217;appelle eBALLution. C&#8217;est un casse-brique qui vous fera voyager dans [...]]]></description>
			<content:encoded><![CDATA[<p>Cela fait déjà quelque temps que je développe un petit jeu vidéo pour <span class="nobr"><a href="http://www.apple.com/fr/macosx/" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/www.apple.com/fr/macosx/?referer=');">Mac OS X</a></span>, histoire d&#8217;apprendre quelques technologies telles que <a href="http://www.opengl.org/" xml:lang="en" hreflang="en" onclick="pageTracker._trackPageview('/outgoing/www.opengl.org/?referer=');">OpenGL</a>, <a href="http://fr.wikipedia.org/wiki/Cocoa_(Apple)" xml:lang="en" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/fr.wikipedia.org/wiki/Cocoa_Apple?referer=');">Cocoa</a>… ça change de <a href="http://java.com/fr/" onclick="pageTracker._trackPageview('/outgoing/java.com/fr/?referer=');">Java</a>, <abbr title="HyperText Markup Language" xml:lang="en">HTML</abbr> et <abbr title="Cascading Style Sheets" xml:lang="en">CSS</abbr> ! Le moteur est maintenant assez avancé pour que j&#8217;ose en parler.</p>
<p>Le jeu s&#8217;appelle <strong>eBALLution</strong>. C&#8217;est un casse-brique qui vous fera voyager dans le temps afin de vous faire (re)découvrir l&#8217;histoire de la vie et de l&#8217;Homme : de la création de l&#8217;Univers et de notre chère planète Terre jusqu&#8217;à la vie de tous les jours, en passant par les dinosaures, l&#8217;Antiquité, le Moyen-Âge, les grandes découvertes, … Ce jeu sera gratuit, mais j&#8217;accepterai avec plaisir les dons :-)</p>
<p>Le jeu a déjà son site internet, <a href="http://www.eballution.com" onclick="pageTracker._trackPageview('/outgoing/www.eballution.com?referer=');">eballution.com</a>, sur lequel je publierai des articles lors de mes grandes avancées dans le développement.</p>
<p>Rien n&#8217;est encore définitif, mais voici tout de même quelques images des niveaux de test déjà existants :</p>

<a href='http://www.fruityfred.com/2009/12/08/eballution/eballution1/' title='eBALLution1'><img width="150" height="150" src="http://www.fruityfred.com/wp-content/uploads/2009/12/eBALLution1-150x150.png" class="attachment-thumbnail" alt="eBALLution1" title="eBALLution1" /></a>
<a href='http://www.fruityfred.com/2009/12/08/eballution/eballution2/' title='eBALLution2'><img width="150" height="150" src="http://www.fruityfred.com/wp-content/uploads/2009/12/eBALLution2-150x150.png" class="attachment-thumbnail" alt="eBALLution2" title="eBALLution2" /></a>
<a href='http://www.fruityfred.com/2009/12/08/eballution/eballution3/' title='eBALLution3'><img width="150" height="150" src="http://www.fruityfred.com/wp-content/uploads/2009/12/eBALLution3-150x150.png" class="attachment-thumbnail" alt="eBALLution3" title="eBALLution3" /></a>

</p>
<p>Je prévois de sortir une version beta pour la fin de l&#8217;année… prochaine (2010). Eh oui, ça demande du temps de confectionner et peaufiner les différents niveaux, surtout que j&#8217;en ai prévu un nombre assez important. C&#8217;est qu&#8217;il y a 13,8 milliards d&#8217;années à retracer !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fruityfred.com/2009/12/08/eballution/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Toutes les recettes des desserts de votre enfance sur votre iPhone</title>
		<link>http://www.fruityfred.com/2009/06/15/toutes-les-recettes-des-desserts-de-votre-enfance-sur-votre-iphone/</link>
		<comments>http://www.fruityfred.com/2009/06/15/toutes-les-recettes-des-desserts-de-votre-enfance-sur-votre-iphone/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 20:47:23 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[Développement]]></category>
		<category><![CDATA[Excursions]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Logiciels]]></category>
		<category><![CDATA[Desserts]]></category>
		<category><![CDATA[recette]]></category>

		<guid isPermaLink="false">http://www.glimpse-fr.org/?p=805</guid>
		<description><![CDATA[Je ne pouvais pas trouver meilleur sujet pour mon blog : une application pour iPhone qui recense toutes les recettes des desserts de notre enfance ! J&#8217;ai nommé : Gourmandise. Oui : biscuits, tartes, crêpes, gaufres, clafoutis (le clafoutis, c&#8217;est exquis !), puddings et crumbles seront désormais toujours à portée de votre plan de travail, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.fruityfred.com/wp-content/uploads/2009/06/application-iphone-gourmandise.png" rel="lightbox[805]"><img class="alignleft size-thumbnail wp-image-806" title="Application Gourmandise pour iPhone" src="http://www.fruityfred.com/wp-content/uploads/2009/06/application-iphone-gourmandise-150x150.png" alt="Application Gourmandise pour iPhone" width="150" height="150" /></a>Je ne pouvais pas trouver meilleur sujet pour mon blog : une application pour <a href="http://www.apple.com/fr/iphone/" xml:lang="en" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/www.apple.com/fr/iphone/?referer=');">iPhone</a> qui recense toutes les recettes des desserts de notre enfance ! J&#8217;ai nommé : <a href="http://www.physalia.fr/gourmandise" onclick="pageTracker._trackPageview('/outgoing/www.physalia.fr/gourmandise?referer=');">Gourmandise</a>. Oui : <strong>biscuits</strong>, <strong>tartes</strong>, <strong>crêpes</strong>, <strong>gaufres</strong>, <strong>clafoutis</strong> (le clafoutis, c&#8217;est exquis !), <strong>puddings</strong> et <strong>crumbles</strong> seront désormais toujours à portée de votre plan de travail, sur votre <a href="http://www.apple.com/fr/iphone/" xml:lang="en" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/www.apple.com/fr/iphone/?referer=');">iPhone</a> ou iPod Touch chéri. Le tout dans une <strong>application très bien réalisée</strong>, tant sur l&#8217;aspect visuel que fonctionnel : <strong>recherche par thème ou ingrédients</strong>, <strong>liste de courses</strong>, notation des recettes avec commentaire&#8230; Cerise sur le gâteau (très appropriée, comme expression) : vous avez envie de vous faire plaisir, mais il y a trop de bonnes recettes dans cette application : <strong>faites tourner la Roue des Desserts</strong> et laissez Gourmandise choisir à votre place ! Vous ne serez jamais déçus : les <strong>50 recettes</strong> proposées sont toutes délicieuses. Enfin&#8230; je n&#8217;ai évidemment pas testé toutes les recettes, hein, mais rien que les photos pourront confirmer ce que je vous dis là.</p>
<p>L&#8217;<a href="http://www.physalia.fr/" onclick="pageTracker._trackPageview('/outgoing/www.physalia.fr/?referer=');">auteur est français</a> et je souhaite le féliciter pour cet <strong>excellent travail</strong> ! L&#8217;application est disponible sur l&#8217;<a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=319498717&amp;mt=8" onclick="pageTracker._trackPageview('/outgoing/itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=319498717_amp_mt=8&amp;referer=');">AppStore</a> pour le <em>prix d&#8217;un kilo de sucre en poudre</em> (1,59 €) !</p>
<p>Quand je vous disais en début d&#8217;article que je ne pouvais pas trouver meilleur sujet : l&#8217;auteur tient également un <a href="http://www.osx-dev.com/" onclick="pageTracker._trackPageview('/outgoing/www.osx-dev.com/?referer=');">forum</a> qui traite du <strong>développement d&#8217;applications sur Mac et <a href="http://www.apple.com/fr/iphone/" xml:lang="en" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/www.apple.com/fr/iphone/?referer=');">iPhone</a></strong>. Eh hop !, dans un article, je parle des trois grands thèmes de mon site ! Non ? Les plus perspicaces d&#8217;entre vous se diront que cet article ne parle pas de randonnées, ce qui jusque là est vrai. Mais après avoir testé Gourmandise, ne croyez-vous pas que quelques (petites) <a href="http://www.fruityfred.com/randonnees/">randonnées</a> vont s&#8217;imposer ?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fruityfred.com/2009/06/15/toutes-les-recettes-des-desserts-de-votre-enfance-sur-votre-iphone/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Révision des MacBook : je vends mes Mac !</title>
		<link>http://www.fruityfred.com/2009/06/08/revision-des-macbook/</link>
		<comments>http://www.fruityfred.com/2009/06/08/revision-des-macbook/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 21:22:05 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[Annonces]]></category>
		<category><![CDATA[Cocoa]]></category>

		<guid isPermaLink="false">http://www.glimpse-fr.org/?p=793</guid>
		<description><![CDATA[Les MacBook ont également été revus aujourd&#8217;hui : plus de puissance, lecteur de cartes SD (oui je sais, toute la concurrence le fait déjà !) et baisse des prix. Dans quelques semaines, je devrais avoir mon nouveau MacBook pro. Et je souhaite n&#8217;avoir plus qu&#8217;une seule machine. Je vais donc revendre mon iMac 20 pouces [...]]]></description>
			<content:encoded><![CDATA[<p>Les <a href="http://www.apple.com/fr/macbook/" xml:lang="en" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/www.apple.com/fr/macbook/?referer=');">MacBook</a> ont également été revus aujourd&#8217;hui : plus de puissance, lecteur de cartes SD (oui je sais, toute la concurrence le fait déjà !) et baisse des prix. Dans quelques semaines, je devrais avoir mon nouveau <a href="http://www.apple.com/fr/macbook/" xml:lang="en" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/www.apple.com/fr/macbook/?referer=');">MacBook</a> pro. Et je souhaite n&#8217;avoir plus qu&#8217;une seule machine.</p>
<p><strong>Je vais donc revendre mon <a href="http://www.apple.com/fr/imac/" xml:lang="en" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/www.apple.com/fr/imac/?referer=');">iMac</a> 20 pouces (que pourtant j&#8217;adooore) ainsi que mon <a href="http://www.apple.com/fr/macbook/" xml:lang="en" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/www.apple.com/fr/macbook/?referer=');">MacBook</a> 13 pouces noir.</strong></p>
<p>Mon <a href="http://www.apple.com/fr/imac/" xml:lang="en" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/www.apple.com/fr/imac/?referer=');">iMac</a> est <strong>disponible immédiatement</strong> pour <a href="http://www.mac2sell.net/permalink/?id=4596c51af5758d13e513a7d5337ad0bb" onclick="pageTracker._trackPageview('/outgoing/www.mac2sell.net/permalink/?id=4596c51af5758d13e513a7d5337ad0bb&amp;referer=');">environ 830 euros</a>. Le <a href="http://www.apple.com/fr/macbook/" xml:lang="en" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/www.apple.com/fr/macbook/?referer=');">MacBook</a> sera disponible quand j&#8217;aurai le nouveau et terminé la migration (dans l&#8217;été, donc) pour <a href="http://www.mac2sell.net/permalink/?id=d6e6fe386233f269f20856cbb1938345" onclick="pageTracker._trackPageview('/outgoing/www.mac2sell.net/permalink/?id=d6e6fe386233f269f20856cbb1938345&amp;referer=');">environ 800 euros</a>. Ces deux (superbes) machines seront entièrement ré-installées proprement avec la dernière version de <span class="nobr"><a href="http://www.apple.com/fr/macosx/" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/www.apple.com/fr/macosx/?referer=');">Mac OS X</a></span> et livrées dans leur boîte d&#8217;origine, avec tous les accessoires (télécommande, chiffon de nettoyage et <abbr title="Digital Versatile Disc" xml:lang="en">DVD</abbr> de <span class="nobr"><a href="http://www.apple.com/fr/macosx/" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/www.apple.com/fr/macosx/?referer=');">Mac OS X</a></span>).</p>
<p>Si vous êtes intéressés, ou si vous connaissez des personnes qui pourraient être intéressées, n&#8217;hésitez pas à <a href="http://www.glimpse-fr.org/apropos/contact/" onclick="pageTracker._trackPageview('/outgoing/www.glimpse-fr.org/apropos/contact/?referer=');">prendre contact avec moi</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fruityfred.com/2009/06/08/revision-des-macbook/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Une liste déroulante qui se souvient et qui propose</title>
		<link>http://www.fruityfred.com/2009/03/06/une-liste-deroulante-qui-se-souvient-et-qui-propose/</link>
		<comments>http://www.fruityfred.com/2009/03/06/une-liste-deroulante-qui-se-souvient-et-qui-propose/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 18:28:34 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Développement]]></category>
		<category><![CDATA[Tutoriels]]></category>
		<category><![CDATA[auto-complétion]]></category>
		<category><![CDATA[datasource]]></category>
		<category><![CDATA[liste déroulante]]></category>
		<category><![CDATA[NSComboBox]]></category>
		<category><![CDATA[User Defaults]]></category>

		<guid isPermaLink="false">http://www.glimpse-fr.org/?p=680</guid>
		<description><![CDATA[Le but de cet article est de nous familiariser avec le widget NSComboBox. Il existe deux manières de peupler une liste déroulante : à la main dans Interface Builder, ou via l&#8217;utilisation d&#8217;une source de données. Nous allons ici nous intéresser à la seconde : l&#8217;utilisation d&#8217;une datasource. Cet article parle de notions présentées dans [...]]]></description>
			<content:encoded><![CDATA[<p>Le but de cet article est de nous familiariser avec le widget <a href="http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/ApplicationKit/Classes/NSComboBox_Class/index.html" onclick="pageTracker._trackPageview('/outgoing/developer.apple.com/DOCUMENTATION/Cocoa/Reference/ApplicationKit/Classes/NSComboBox_Class/index.html?referer=');"><code>NSComboBox</code></a>. Il existe deux manières de peupler une liste déroulante : à la main dans <span xml:lang="en">Interface Builder</span>, ou <em>via</em> l&#8217;utilisation d&#8217;une source de données. Nous allons ici nous intéresser à la seconde : l&#8217;utilisation d&#8217;une <span title="source de données" xml:lang="en">datasource</span>.</p>
<p>Cet article parle de notions présentées dans ce <a href="http://www.glimpse-fr.org/developpement/xcode-interfacebuilder/" onclick="pageTracker._trackPageview('/outgoing/www.glimpse-fr.org/developpement/xcode-interfacebuilder/?referer=');">tutoriel pour <span xml:lang="en">Xcode</span> et <span xml:lang="en">Interface Builder</span></a>. N&#8217;hésitez pas à aller vous rafraîchir la mémoire !</p>
<p>Dans <span xml:lang="en">Interface Builder</span>, ajoutons une <em>Combo Box</em> dans notre vue puis, dans le premier onglet de l&#8217;inspecteur, cochons&#8230; tiens, il est marrant ce verbe conjugué au présent à la première personne du pluriel ! Hum. Cochons, donc, la case <em title="Utilise une source de données" xml:lang="en">Uses Data Source</em>.</p>
<p><strong>La datasource est un objet de votre choix</strong> qui contient les données à afficher dans la liste déroulante. Cet objet <strong>retrouve et stocke les données sous la forme qu&#8217;il souhaite</strong>. Généralement, on a souvent affaire à un <a href="http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSArray_Class/Reference/Reference.html" onclick="pageTracker._trackPageview('/outgoing/developer.apple.com/DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSArray_Class/Reference/Reference.html?referer=');"><code>NSArray</code></a> qui pourrait être lu depuis un fichier <abbr title="Properties List" xml:lang="en">plist</abbr>&#8230; ou depuis les <a xml:lang="en" href="http://developer.apple.com/documentation/Cocoa/Conceptual/UserDefaults/UserDefaults.html" onclick="pageTracker._trackPageview('/outgoing/developer.apple.com/documentation/Cocoa/Conceptual/UserDefaults/UserDefaults.html?referer=');"><em title="base de données des préférences de l'utilisateur" xml:lang="en">User Defaults</em></a>. Bref, la seule contrainte est que cet objet doit <strong>implémenter le protocole informel <a href="http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/ApplicationKit/Protocols/NSComboBoxDataSource_Protocol/Reference/Reference.html" onclick="pageTracker._trackPageview('/outgoing/developer.apple.com/DOCUMENTATION/Cocoa/Reference/ApplicationKit/Protocols/NSComboBoxDataSource_Protocol/Reference/Reference.html?referer=');"><code>NSComboBoxDataSource</code></a></strong> :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>numberOfItemsInComboBox<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSComboBox</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>combo;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>comboBox<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSComboBox</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>combo objectValueForItemAtIndex<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>index</pre></div></div>

<p>La première méthode doit retourner <strong>le nombre d&#8217;éléments</strong> qui devront être présents dans la liste déroulante. La seconde retourne <strong>l&#8217;objet pour un index donné</strong> (le message <code>description</code> sera envoyé à cet objet pour l&#8217;affichage dans la liste déroulante). Remarquez que ces méthodes acceptent toutes les deux une <code>NSComboBox</code> en argument. Ceci permet de n&#8217;utiliser qu&#8217;une seule classe pour gérer plusieurs sources de données : en fonction de l&#8217;objet <code>combo</code> passé en argument, il est facile de déterminer les données à utiliser.</p>
<p>Dans notre exemple, considérons que l&#8217;objet datasource est notre contrôleur principal, déclaré dans <span xml:lang="en">Interface Builder</span>. On peut donc utiliser sa méthode <code>awakeFromNib</code> pour initialiser ce qu&#8217;on veut. Ici, on va récupérer des données stockées dans les <em>User Defaults</em> :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> loadDataSource <span style="color: #002200;">&#123;</span>
   <span style="color: #11740a; font-style: italic;">// On récupère une instance des User Defaults</span>
   <span style="color: #400080;">NSUserDefaults</span> <span style="color: #002200;">*</span>defaults <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSUserDefaults</span> standardUserDefaults<span style="color: #002200;">&#93;</span>;
   <span style="color: #11740a; font-style: italic;">// On lit les valeurs avec la clé qu'on a choisit (ici : ComboBoxValues)</span>
   <span style="color: #11740a; font-style: italic;">// dataSource est un NSArray déclaré dans le fichier header de cette classe</span>
   dataSource <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>defaults arrayForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;ComboBoxValues&quot;</span><span style="color: #002200;">&#93;</span>
                           sortedArrayUsingSelector<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>compare<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
   <span style="color: #11740a; font-style: italic;">// Au passage, on trie les éléments par ordre alphabétique :-)</span>
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>awakeFromNib <span style="color: #002200;">&#123;</span>
   <span style="color: #11740a; font-style: italic;">// On charge nos données depuis les &quot;préférences&quot; de l'utilisateur</span>
   <span style="color: #002200;">&#91;</span>self loadDataSource<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Ensuite, nous allons implémenter les deux fameuses méthodes du protocole <code>NSComboBoxDataSource</code> qui sont, comme vous le constatez, très complexes :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span>numberOfItemsInComboBox<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSComboBox</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>aComboBox <span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span>dataSource count<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>comboBox<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSComboBox</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>aComboBox objectValueForItemAtIndex<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span>index <span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span>dataSource objectAtIndex<span style="color: #002200;">:</span>index<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Il nous reste à <strong>indiquer à notre <code>NSCombBox</code> la datasource à utiliser</strong>. Allons dans <span xml:lang="en">Interface Builder</span>, sélectionnons la liste déroulante, activons l&#8217;onglet <em>Connections</em> de l&#8217;inspecteur puis relions l&#8217;entrée <em>dataSource</em> à notre contrôleur.</p>
<p>Très bien, mais il faut encore <strong>ajouter les données saisies dans les <em>User Defaults</em></strong>, sinon l&#8217;entrée <em>ComboBoxValues</em> (voir la méthode <code>loadDataSource</code>) sera toujours un tableau vide&#8230; Et on aurait fait tout ça pour rien ! Il faut d&#8217;abord obtenir une instance de notre liste déroulante dans notre contrôleur via l&#8217;utilisation des <code>IBOutlet</code> (plus d&#8217;informations <a title="Tutoriels Xcode et Interface Builder" href="http://www.glimpse-fr.org/developpement/xcode-interfacebuilder/" onclick="pageTracker._trackPageview('/outgoing/www.glimpse-fr.org/developpement/xcode-interfacebuilder/?referer=');">ici</a>). Ensuite, il faut déterminer le moment où vous l&#8217;on souhaite que la valeur soit sauvegardée : lorsque que l&#8217;utilisateur termine la saisie dans la liste déroulante ou bien lors d&#8217;une autre action (sauvegarde des différents champs d&#8217;un formulaire, par exemple). Dans les deux cas, il faut déclarer une <code>IBAction</code> quelque part (plus d&#8217;informations <a title="Tutoriels Xcode et Interface Builder" href="http://www.glimpse-fr.org/developpement/xcode-interfacebuilder/" onclick="pageTracker._trackPageview('/outgoing/www.glimpse-fr.org/developpement/xcode-interfacebuilder/?referer=');">ici</a>). Dans cette action, il nous faut ajouter un morceau de code qui ressemble à ceci :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// Récupération de la valeur saisie dans la NSComboBox</span>
<span style="color: #11740a; font-style: italic;">// comboBox est un IBOutlet déclaré dans le fichier header (voir plus bas)</span>
<span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>newValue <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>comboBox stringValue<span style="color: #002200;">&#93;</span>;
<span style="color: #11740a; font-style: italic;">// On vérifie si la valeur n'est pas déjà présente, auquel cas il n'y a</span>
<span style="color: #11740a; font-style: italic;">// rien à faire.</span>
<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span> <span style="color: #002200;">&#91;</span>taskNameDataSource containsObject<span style="color: #002200;">:</span> newValue<span style="color: #002200;">&#93;</span> <span style="color: #002200;">==</span> <span style="color: #a61390;">NO</span> <span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
   <span style="color: #400080;">NSUserDefaults</span> <span style="color: #002200;">*</span>defaults <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSUserDefaults</span> standardUserDefaults<span style="color: #002200;">&#93;</span>;
   <span style="color: #11740a; font-style: italic;">// On va ajouter un élément à notre dataSource :</span>
   <span style="color: #11740a; font-style: italic;">// pour cela, il nous faut un NSMutableArray (NSArray étant en lecture seule)</span>
   <span style="color: #400080;">NSMutableArray</span> <span style="color: #002200;">*</span>mutableDS <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSMutableArray</span> arrayWithArray<span style="color: #002200;">:</span> dataSource<span style="color: #002200;">&#93;</span>;
   <span style="color: #11740a; font-style: italic;">// On ajoute la nouvelle valeur</span>
   <span style="color: #002200;">&#91;</span>mutableDS addObject<span style="color: #002200;">:</span> newValue<span style="color: #002200;">&#93;</span>;
   <span style="color: #11740a; font-style: italic;">// On stocke le tout dans les User Defaults</span>
   <span style="color: #002200;">&#91;</span>defaults setValue<span style="color: #002200;">:</span> mutableDS forKey<span style="color: #002200;">:</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;ComboBoxValues&quot;</span><span style="color: #002200;">&#93;</span>;
   <span style="color: #11740a; font-style: italic;">// Et on met à jour la liste déroulante pour qu'elle prenne la nouvelle</span>
   <span style="color: #11740a; font-style: italic;">// valeur en compte (il y a peut-être mieux à faire ici).</span>
   <span style="color: #002200;">&#91;</span>self loadDataSource<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Enfin, voici un exemple de fichier header pour notre contrôleur principal :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">@interface</span> AppController <span style="color: #002200;">:</span> <span style="color: #400080;">NSObject</span> <span style="color: #002200;">&#123;</span>
	IBOutlet <span style="color: #400080;">NSComboBox</span><span style="color: #002200;">*</span> comboBox;
	<span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span>dataSource;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">// Méthodes de gestion de la datasource pour la NSComboBox</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span>numberOfItemsInComboBox<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSComboBox</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>aComboBox;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>comboBox<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSComboBox</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>aComboBox objectValueForItemAtIndex<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span>index;</pre></div></div>

<p>Une dernière chose : il est possible de voir les préférences d&#8217;une application depuis le <strong>Terminal</strong>, grâce à la commande suivante :</p>
<p><kbd class="console"><br />
 defaults read identifiant.de.votre.application<br />
 </kbd></p>
<p>L&#8217;identifiant de votre application doit être unique et on le définit dans <span xml:lang="en">Xcode</span>, dans les informations de la target : dans l&#8217;arborescence de <span xml:lang="en">Xcode</span>, dans la section <em>Targets</em>, faites un clic droit sur votre target puis <em>Get Info</em> et enfin onglet <em>Properties</em> ; le champ à renseigner est&#8230; Tah daaah : <em>Identifier</em>. Utilisez un nom comme les packages <a href="http://java.com/fr/" onclick="pageTracker._trackPageview('/outgoing/java.com/fr/?referer=');">Java</a> : <em>com.entreprise.application</em>. Attention : les defaults sont généralement synchronisés et enregistrés sur le disque à la fermeture de l&#8217;application (ou avant, mais on ne sait pas quand) : il est donc possible de ne pas les voir tout de suite à jour dans le Terminal.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fruityfred.com/2009/03/06/une-liste-deroulante-qui-se-souvient-et-qui-propose/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Savoir si une application est lancée ou pas</title>
		<link>http://www.fruityfred.com/2009/03/06/savoir-si-une-application-est-lancee-ou-pas/</link>
		<comments>http://www.fruityfred.com/2009/03/06/savoir-si-une-application-est-lancee-ou-pas/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 17:18:24 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Développement]]></category>
		<category><![CDATA[Tutoriels]]></category>
		<category><![CDATA[NSWorkspace]]></category>

		<guid isPermaLink="false">http://www.glimpse-fr.org/?p=693</guid>
		<description><![CDATA[Pour savoir si une application est lancée ou pas, on peut utiliser les services fournis par la classe NSWorkspace, et notamment sa méthode launchedApplications : - &#40;BOOL&#41; isAppLaunched: &#40;NSString *&#41; appIdentifier &#123; NSArray *apps = &#91;&#91;NSWorkspace sharedWorkspace&#93; launchedApplications&#93;; for &#40;NSDictionary *appInfo in apps&#41; &#123; NSString *appId = &#91;appInfo objectForKey: @&#34;NSApplicationBundleIdentifier&#34;&#93;; if &#40;&#91;appId isEqualTo: appIdentifier&#93;&#41; &#123; [...]]]></description>
			<content:encoded><![CDATA[<p>Pour savoir si une application est lancée ou pas, on peut utiliser les services fournis par la classe <a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWorkspace_Class/Reference/Reference.html" onclick="pageTracker._trackPageview('/outgoing/developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWorkspace_Class/Reference/Reference.html?referer=');"><code>NSWorkspace</code></a>, et notamment sa méthode <code>launchedApplications</code> :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span> isAppLaunched<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> appIdentifier <span style="color: #002200;">&#123;</span>
   <span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span>apps <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSWorkspace</span> sharedWorkspace<span style="color: #002200;">&#93;</span> launchedApplications<span style="color: #002200;">&#93;</span>;
   <span style="color: #a61390;">for</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSDictionary</span> <span style="color: #002200;">*</span>appInfo <span style="color: #a61390;">in</span> apps<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
      <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>appId <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>appInfo objectForKey<span style="color: #002200;">:</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;NSApplicationBundleIdentifier&quot;</span><span style="color: #002200;">&#93;</span>;
      <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>appId isEqualTo<span style="color: #002200;">:</span> appIdentifier<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
         <span style="color: #a61390;">return</span> <span style="color: #a61390;">YES</span>;
      <span style="color: #002200;">&#125;</span>
   <span style="color: #002200;">&#125;</span>
   <span style="color: #a61390;">return</span> <span style="color: #a61390;">NO</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span> <span style="color: #002200;">&#91;</span>self isAppLaunched<span style="color: #002200;">:</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;com.apple.iCal&quot;</span><span style="color: #002200;">&#93;</span> <span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
   NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;iCal est lancé !&quot;</span><span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.fruityfred.com/2009/03/06/savoir-si-une-application-est-lancee-ou-pas/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Développer son framework Cocoa</title>
		<link>http://www.fruityfred.com/2009/02/12/developper-son-framework-cocoa/</link>
		<comments>http://www.fruityfred.com/2009/02/12/developper-son-framework-cocoa/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 00:38:09 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Développement]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Tutoriels]]></category>
		<category><![CDATA[framework]]></category>

		<guid isPermaLink="false">http://www.glimpse-fr.org/?p=643</guid>
		<description><![CDATA[Dans cet article, je vous explique comment créer votre propre framework Cocoa (écrit en Objective-C, donc), afin de réutiliser du code dans plusieurs de vos applications. Le framework en question a pour vocation d&#8217;être inclus dans le bundle de vos applications (on ne va tout de même pas copier des librairies un peu partout !). [...]]]></description>
			<content:encoded><![CDATA[<p>Dans cet article, je vous explique comment créer <strong>votre propre framework <a href="http://fr.wikipedia.org/wiki/Cocoa_(Apple)" xml:lang="en" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/fr.wikipedia.org/wiki/Cocoa_Apple?referer=');">Cocoa</a></strong> (écrit en Objective-C, donc), afin de réutiliser du code dans plusieurs de vos applications. Le framework en question a pour vocation d&#8217;être <strong>inclus dans le bundle de vos applications</strong> (on ne va tout de même pas copier des librairies un peu partout !). Il y a <strong>deux grandes étapes</strong> :</p>
<ul>
<li>la création du framework,</li>
<li>l&#8217;utilisation du framework dans vos applications.</li>
</ul>
<p><strong>Création du framework</strong></p>
<p><img class="alignleft size-full wp-image-646 no-border" title="Cocoa Framework" src="http://www.fruityfred.com/wp-content/uploads/2009/02/cocoa-framework.png" alt="Cocoa Framework" width="118" height="75" /></p>
<p>Dans <span xml:lang="en">Xcode</span>, choisissez <em>File > New Project&#8230;</em> puis choisissez un projet de type <em>Framework</em> et plus précisément<em> <a href="http://fr.wikipedia.org/wiki/Cocoa_(Apple)" xml:lang="en" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/fr.wikipedia.org/wiki/Cocoa_Apple?referer=');">Cocoa</a> Framework.</em> Saisissez un joli nom pour votre framework. </p>
<p>Faites un clic droit sur la target de votre framework puis choisissez <em>Set Role > Public</em> : ceci aura pour effet de copier les fichiers headers (.h) dans le framework, ce qui s&#8217;avère très utile pour utiliser ledit framework !</p>
<p><img class="aligncenter size-full wp-image-649 screenshot" title="Framework Set Role Public" src="http://www.fruityfred.com/wp-content/uploads/2009/02/framework-set-role-public.png" alt="Framework Set Role Public" width="325" height="139" /></p>
<p>Éditez maintenant les <strong>propriétés de la target</strong> de votre framework (clic droit sur la target puis <em>Get Info</em>). Dans l&#8217;onglet <em>Build</em>, recherchez la section <em>Deployment</em> puis remplacez la valeur de la propriété <em>Installation Directory</em> par <code>@executable_path/../Frameworks</code>. Vous devriez avoir quelque chose qui ressemble à ceci :</p>
<p><img class="aligncenter size-full wp-image-652 screenshot" title="Framework Build Properties" src="http://www.fruityfred.com/wp-content/uploads/2009/02/framework-build-properties.png" alt="Framework Build Properties" width="566" height="194" /></p>
<p>Ajoutez ensuite toutes les classes et ressources à votre framework puis compilez le framework (<em>Build</em>). Rendez-vous dans le répertoire <em>build</em> de votre projet et vérifiez que vous avez bien un dossier avec l&#8217;extension <em>.framework</em>.</p>
<p><strong>Utilisation du framework dans vos applications</strong></p>
<p>Il y a deux choses importantes à faire ici :</p>
<ul>
<li><strong>ajouter le framework</strong> à votre application (ce qui semble logique&#8230;),</li>
<li>faire en sorte que ce framework se retrouve dans le dossier <em>Frameworks</em> <strong>à l&#8217;intérieur du bundle de votre application</strong> une fois votre application compilée.</li>
</ul>
<p>Pour ajouter le framework à votre application, faites un clic droit sur la section <em>Frameworks</em> dans l&#8217;arborescence du projet puis<em> Add > Existing Frameworks&#8230;</em> puis parcourez votre disque à la recherche de votre framework (qui est un dossier à l&#8217;extension <em>.framework</em>, je vous le rappelle).</p>
<p><img class="aligncenter size-full wp-image-654 screenshot" title="application-add-existing-framework" src="http://www.fruityfred.com/wp-content/uploads/2009/02/application-add-existing-framework.png" alt="application-add-existing-framework" width="467" height="159" /></p>
<p>Pour la deuxième partie, faites un clic droit sur la target de votre application puis <em>Add > New Build Phase > New Copy Files Build Phase</em>.</p>
<p><img class="aligncenter size-full wp-image-656 screenshot" title="Add New Build Phase" src="http://www.fruityfred.com/wp-content/uploads/2009/02/add-new-build-phase.png" alt="Add New Build Phase" width="656" height="76" /></p>
<p>Dans la boîte de dialogue, sélectionnez <em>Frameworks</em> pour le champ <em>Destination</em> et fermez la fenêtre (surtout qu&#8217;il fait froid en ce moment).</p>
<p><img class="aligncenter size-full wp-image-657 screenshot" title="Destination Frameworks" src="http://www.fruityfred.com/wp-content/uploads/2009/02/destination-frameworks.png" alt="Destination Frameworks" width="276" height="29" /></p>
<p>Enfin, dans l&#8217;arborescence du projet, faites glisser votre framework depuis la section <em>Frameworks</em> vers la nouvelle section <em>Copy Files</em> : vous devriez alors le voir apparaître en dessous et le libellé de la phase est maintenant <em>Copy Files (1)</em>.</p>
<p>Dans votre application, vous devrez inclure les fichiers headers de vos classes de cette manière :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#import &quot;nomDuFramework/Classe1.h&quot;</span></pre></div></div>

<p>Voilà, ça devrait marcher&#8230; amusez-vous bien !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fruityfred.com/2009/02/12/developper-son-framework-cocoa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Glisser-déposer de fichiers dans votre application</title>
		<link>http://www.fruityfred.com/2009/01/19/glisser-deposer-de-fichiers-dans-votre-application/</link>
		<comments>http://www.fruityfred.com/2009/01/19/glisser-deposer-de-fichiers-dans-votre-application/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 20:49:01 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Développement]]></category>
		<category><![CDATA[Tutoriels]]></category>
		<category><![CDATA[drag and drop]]></category>
		<category><![CDATA[NSView]]></category>

		<guid isPermaLink="false">http://www.glimpse-fr.org/?p=596</guid>
		<description><![CDATA[Dans cet article, je vais vous montrer comment on peut très simplement gérer le drag and drop de fichiers depuis le Finder vers votre application. Il faut créer une sous-classe de NSView, par exemple DropFilesView. Dans cette classe, il faut indiquer à Cocoa que cette vue accepte la dépose de fichiers par drag and drop. [...]]]></description>
			<content:encoded><![CDATA[<p>Dans cet article, je vais vous montrer comment on peut très simplement gérer le <span title="glisser/déposer" xml:lang="en">drag and drop</span> de fichiers depuis le Finder vers votre application.</p>
<p>Il faut créer une sous-classe de <a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/nsview_Class/Reference/NSView.html" onclick="pageTracker._trackPageview('/outgoing/developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/nsview_Class/Reference/NSView.html?referer=');"><code>NSView</code></a>, par exemple <code>DropFilesView</code>. Dans cette classe, il faut indiquer à <a href="http://fr.wikipedia.org/wiki/Cocoa_(Apple)" xml:lang="en" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/fr.wikipedia.org/wiki/Cocoa_Apple?referer=');">Cocoa</a> que cette vue <strong>accepte la dépose de fichiers par drag and drop</strong>. Pour cela, on implémente la méthode <code>-awakeFromNib</code> comme ceci :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> awakeFromNib <span style="color: #002200;">&#123;</span>
    <span style="color: #002200;">&#91;</span>self registerForDraggedTypes<span style="color: #002200;">:</span>
     <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSArray</span> arrayWithObjects<span style="color: #002200;">:</span> NSFilenamesPboardType, <span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>
    <span style="color: #002200;">&#93;</span>;
    <span style="color: #11740a; font-style: italic;">// Attention à ne pas oublier le &quot;nil&quot; en dernier argument de</span>
    <span style="color: #11740a; font-style: italic;">// arrayWithObjects !</span>
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Je vous rappelle que la méthode <code>-awakeFromNib</code> <strong>est appelée automatiquement</strong> lorsque votre application est chargée par <a href="http://fr.wikipedia.org/wiki/Cocoa_(Apple)" xml:lang="en" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/fr.wikipedia.org/wiki/Cocoa_Apple?referer=');">Cocoa</a> : c&#8217;est donc un emplacement judicieux pour <strong>initialiser des données propres à la vue</strong>. Il faut ensuite implémenter les méthodes suivantes, en fonction des besoins :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>NSDragOperation<span style="color: #002200;">&#41;</span>draggingEntered<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>
    <span style="color: #11740a; font-style: italic;">// Appelée UNE FOIS lorsque la souris commence à survoler la vue</span>
    <span style="color: #11740a; font-style: italic;">// dans un processus de drag and drop.</span>
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>NSDragOperation<span style="color: #002200;">&#41;</span>draggingExited<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>
    <span style="color: #11740a; font-style: italic;">// Appelée lorsque la souris quitte la zone de survol de la vue</span>
    <span style="color: #11740a; font-style: italic;">// dans un processus de drag and drop.</span>
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>NSDragOperation<span style="color: #002200;">&#41;</span>draggingUpdated<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>
    <span style="color: #11740a; font-style: italic;">// Appelée à chaque fois que la souris est déplacée au dessus de la vue</span>
    <span style="color: #11740a; font-style: italic;">// dans un processus de drag and drop.</span>
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Ces trois méthodes retournent toutes une valeur de type <a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSDraggingInfo_Protocol/Reference/Reference.html#//apple_ref/c/tdef/NSDragOperation" onclick="pageTracker._trackPageview('/outgoing/developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSDraggingInfo_Protocol/Reference/Reference.html_//apple_ref/c/tdef/NSDragOperation?referer=');"><code>NSDragOperation</code></a>, indiquant <strong>si la dépose est autorisée</strong> (<code>NSDragOperationGeneric</code>, &#8230;) <strong>ou pas</strong> (<code>NSDragOperationNone</code>). Ces méthodes peuvent donc servir à<strong> vérifier que la vue accepte bien les données qui sont sur le point d&#8217;être déposées</strong>, auquel cas on retourne une valeur autre que <code>NSDragOperationNone</code> ; si la dépose n&#8217;est pas permise, on retourne <code>NSDragOperationNone</code>.</p>
<p>Enfin, il faut gérer le cas où <strong>l&#8217;utilisateur dépose effectivement les fichiers</strong>, auquel cas la méthode <code>-performDragOperation:</code> est appelée : il convient donc de la surcharger à votre guise&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>performDragOperation<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>
    <span style="color: #11740a; font-style: italic;">// Appelée lorsque l'utilisateur a déposer les fichiers sur la vue :</span>
    <span style="color: #11740a; font-style: italic;">// on doit alors récupérer la liste des fichiers et les traiter...</span>
    <span style="color: #400080;">NSPasteboard</span> <span style="color: #002200;">*</span>pboard <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>sender draggingPasteboard<span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>pboard types<span style="color: #002200;">&#93;</span> containsObject<span style="color: #002200;">:</span>NSFilenamesPboardType<span style="color: #002200;">&#93;</span> <span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        <span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span>files <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>pboard propertyListForType<span style="color: #002200;">:</span>NSFilenamesPboardType<span style="color: #002200;">&#93;</span>;
        <span style="color: #11740a; font-style: italic;">// files contient maintenant la liste des fichiers (avec chemin complet)</span>
        <span style="color: #11740a; font-style: italic;">// qui ont été déposés sur la vue par l'utilisateur.</span>
        <span style="color: #11740a; font-style: italic;">// Faites donc ici ce que vous voulez avec files ;-)</span>
    <span style="color: #002200;">&#125;</span>
    <span style="color: #a61390;">return</span> <span style="color: #a61390;">YES</span>; <span style="color: #11740a; font-style: italic;">// On indique que le drag and drop a été concluant.</span>
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Vous pouvez télécharger le projet complet pour <span xml:lang="en">Xcode</span> : <a href="http://www.glimpse-fr.org/download/tutoriels/DropFilesTutorial.zip" onclick="pageTracker._trackPageview('/outgoing/www.glimpse-fr.org/download/tutoriels/DropFilesTutorial.zip?referer=');"><em>DropFilesTutorial.zip</em></a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fruityfred.com/2009/01/19/glisser-deposer-de-fichiers-dans-votre-application/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Données membres statiques en Objective-C</title>
		<link>http://www.fruityfred.com/2009/01/12/donnees-membres-statiques-en-objective-c/</link>
		<comments>http://www.fruityfred.com/2009/01/12/donnees-membres-statiques-en-objective-c/#comments</comments>
		<pubDate>Mon, 12 Jan 2009 21:38:46 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Développement]]></category>
		<category><![CDATA[Tutoriels]]></category>
		<category><![CDATA[POO]]></category>
		<category><![CDATA[statique]]></category>

		<guid isPermaLink="false">http://www.glimpse-fr.org/?p=585</guid>
		<description><![CDATA[Objective-C ne permet pas de déclarer une donnée membre statique dans une classe via l&#8217;utilisation du mot-clé static, comme en Java par exemple. En fait, il suffit de déclarer une variable statique dans la section @implementation de la classe : @implementation MyClass // Déclaration d'une donnée membre STATIQUE static NSDictionary* cacheMap; ... @end Pour initialiser [...]]]></description>
			<content:encoded><![CDATA[<p>Objective-C ne permet pas de déclarer une donnée membre statique dans une classe <em>via</em> l&#8217;utilisation du mot-clé <em>static</em>, comme en <a href="http://java.com/fr/" onclick="pageTracker._trackPageview('/outgoing/java.com/fr/?referer=');">Java</a> par exemple. En fait, il suffit de déclarer une variable statique <strong>dans la section <code>@implementation</code> de la classe</strong> :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">@implementation</span> MyClass
<span style="color: #11740a; font-style: italic;">// Déclaration d'une donnée membre STATIQUE</span>
<span style="color: #a61390;">static</span> <span style="color: #400080;">NSDictionary</span><span style="color: #002200;">*</span> cacheMap;
...
<span style="color: #a61390;">@end</span></pre></div></div>

<p>Pour initialiser cette variable, notamment s&#8217;il s&#8217;agit d&#8217;un objet, il suffit d&#8217;implémenter la méthode statique <em>initialize</em> de la classe concernée et d&#8217;y initialiser la donnée statique :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">+</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> initialize <span style="color: #002200;">&#123;</span>
   cacheMap <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>NSDisctionary dictionary<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Toutes les méthodes statiques de votre classe peuvent utiliser cette donnée statique : <a href="http://fr.wikipedia.org/wiki/Cocoa_(Apple)" xml:lang="en" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/fr.wikipedia.org/wiki/Cocoa_Apple?referer=');">Cocoa</a> se charge d&#8217;envoyer le message <em>initialize</em> à votre classe <strong>avant tout autre appel</strong>.</p>
<p><strong>Attention</strong> : cette donnée statique <strong>ne sera pas visible dans les classes qui étendent votre classe</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fruityfred.com/2009/01/12/donnees-membres-statiques-en-objective-c/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Dessiner dans une NSView</title>
		<link>http://www.fruityfred.com/2009/01/04/dessiner-dans-une-nsview/</link>
		<comments>http://www.fruityfred.com/2009/01/04/dessiner-dans-une-nsview/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 17:51:44 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Développement]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Tutoriels]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[Interface Builder]]></category>
		<category><![CDATA[NSImage]]></category>
		<category><![CDATA[NSTimer]]></category>
		<category><![CDATA[NSView]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://www.glimpse-fr.org/?p=559</guid>
		<description><![CDATA[Dans Interface Builder, sélectionnez la vue en question et, dans l&#8217;onglet Identity de l&#8217;Inspecteur, indiquez un nom de classe pour votre vue dans le champ Class (par exemple : GameView). Sélectionnez File > Write Class Files&#8230; dans le menu principal de Interface Builder pour générer cette classe dans le projet. De retour dans Xcode, ouvrez [...]]]></description>
			<content:encoded><![CDATA[<p>Dans <span xml:lang="en"><span xml:lang="en">Interface Builder</span></span>, sélectionnez la vue en question et, dans l&#8217;onglet <em>Identity</em> de l&#8217;Inspecteur, indiquez <strong>un nom de classe</strong> pour votre vue dans le champ <em>Class</em> (par exemple : <code>GameView</code>). Sélectionnez <em>File > Write Class Files&#8230;</em> dans le menu principal de <span xml:lang="en"><span xml:lang="en">Interface Builder</span></span> pour générer cette classe dans le projet.</p>
<p>De retour dans <span xml:lang="en"><span xml:lang="en">Xcode</span></span>, ouvrez le <strong>fichier de déclaration</strong> de cette classe (<code>GameView.h</code>) et faites étendre la classe de <code><a xml:lang="en" hreflang="en" href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/nsview_Class/Reference/NSView.html" onclick="pageTracker._trackPageview('/outgoing/developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/nsview_Class/Reference/NSView.html?referer=');">NSView</a></code> :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">@interface</span> GameView <span style="color: #002200;">:</span> <span style="color: #400080;">NSView</span> <span style="color: #002200;">&#123;</span>
   <span style="color: #400080;">NSImage</span> <span style="color: #002200;">*</span>background;
<span style="color: #002200;">&#125;</span>
<span style="color: #a61390;">@end</span></pre></div></div>

<p>Ensuite, éditez le <strong>fichier d&#8217;implémentation</strong> de la classe (<code>GameView.m</code>) et implémentez la méthode <code>-drawRect:</code> :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>awakeFromNib <span style="color: #002200;">&#123;</span>
   <span style="color: #11740a; font-style: italic;">// La variable &quot;background&quot; est déclarée dans le fichier header (.h).</span>
   background <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSImage</span> imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;background.png&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>drawRect<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">NSRect</span><span style="color: #002200;">&#41;</span>rect
<span style="color: #002200;">&#123;</span>
   <span style="color: #002200;">&#91;</span>background dissolveToPoint<span style="color: #002200;">:</span>NSMakePoint<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0</span>, <span style="color: #2400d9;">0</span><span style="color: #002200;">&#41;</span> fraction<span style="color: #002200;">:</span><span style="color: #2400d9;">1.0</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Notez que l&#8217;image est initialisée dans la méthode <code>-awakeFromNib</code>, qui est appelée lors de l&#8217;initialisation de la vue.</p>
<p>Pour <strong>animer le contenu de la vue</strong>, et donc pour forcer le rafraîchissement de la vue, il est possible d&#8217;utiliser un <code><a xml:lang="en" hreflang="en" href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/Reference/NSTimer.html#//apple_ref/occ/cl/NSTimer" onclick="pageTracker._trackPageview('/outgoing/developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/Reference/NSTimer.html_//apple_ref/occ/cl/NSTimer?referer=');">NSTimer</a></code> pour indiquer à la vue qu&#8217;elle doit se re-dessiner :</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>awakeFromNib <span style="color: #002200;">&#123;</span>
   background <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSImage</span> imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;background.png&quot;</span><span style="color: #002200;">&#93;</span>;
   <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSTimer</span>
      scheduledTimerWithTimeInterval<span style="color: #002200;">:</span><span style="color: #2400d9;">0.01</span>
      target<span style="color: #002200;">:</span>self
      selector<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>refresh<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span>
      userInfo<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span>
      repeats<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>refresh<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSTimer</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>timer <span style="color: #002200;">&#123;</span>
   <span style="color: #002200;">&#91;</span>self setNeedsDisplay<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>La méthode <code>-refresh:</code> sera appelée toutes les 0,01 seconde (100 fois par secondes, donc) et demandera à la vue de se re-dessiner, via l&#8217;appel à <code>setNeedsDisplay:YES</code>. Évidemment, ceci n&#8217;a de sens que si l&#8217;image (ou sa position) change.</p>
<p>Côté <strong>performances</strong>, j&#8217;ai fait quelques tests : j&#8217;affiche 1000 fois la même image (26&#215;26 pixels) toutes les 0.01 seconde en la décalant de 1 pixel et ça ne gêne pas du tout mon <a href="http://www.apple.com/fr/imac/" xml:lang="en" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/www.apple.com/fr/imac/?referer=');">iMac</a>, <strong>l&#8217;animation est impeccable</strong> !</p>
<p>Je précise que ce n&#8217;est pas ici une technique très avancée pour animer du contenu, car<strong> cela ne tient pas compte de la puissance de la machine</strong>. En vérité, dans la méthode <code>-refresh:</code><strong>, il faudrait vérifier si l&#8217;image doit être déplacée (ou modifiée) en fonction du temps qui s&#8217;est écoulé depuis la dernière modification de cette image</strong>. Ainsi, peu importe la résolution du timer utilisée, ou la capacité de la machine à afficher du contenu graphique, l&#8217;image sera toujours correcte (en fonction du temps écoulé), même si l&#8217;animation n&#8217;est pas fluide. Il est aussi possible d&#8217;utiliser <code><a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSAnimation_Class/Reference/Reference.html" onclick="pageTracker._trackPageview('/outgoing/developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSAnimation_Class/Reference/Reference.html?referer=');">NSAnimation</a></code> pour des animations complexes &laquo;&nbsp;finies&nbsp;&raquo;.</p>
<p>Pour terminer, si votre but est de faire de l&#8217;animation complexe (2D ou 3D), comme pour la programmation d&#8217;un jeu, je ne peux que vous conseiller de vous tourner vers <a href="http://www.opengl.org/" onclick="pageTracker._trackPageview('/outgoing/www.opengl.org/?referer=');">OpenGL</a>. Je suis en train de m&#8217;y mettre, je publierai donc prochainement des articles à ce propos.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fruityfred.com/2009/01/04/dessiner-dans-une-nsview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gestion des préférences d&#8217;une application Cocoa</title>
		<link>http://www.fruityfred.com/2008/09/30/gestion-des-preferences-dune-application-cocoa/</link>
		<comments>http://www.fruityfred.com/2008/09/30/gestion-des-preferences-dune-application-cocoa/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 23:35:00 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Développement]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Tutoriels]]></category>

		<guid isPermaLink="false">http://www.glimpse-fr.org/?p=229</guid>
		<description><![CDATA[Pour les développeurs qui débutent sous Mac OS X, voici un didacticiel pour apprendre à gérer les préférences d&#8217;une application Cocoa. Il est nécessaire d&#8217;avoir quelques (bonnes) notions en Objective-C, Cocoa, Xcode et Interface Builder. Attention : ce didacticiel n&#8217;explique pas comment faire un panneau pour les préférences système.]]></description>
			<content:encoded><![CDATA[<p>Pour les développeurs qui débutent sous <span class="nobr"><a href="http://www.apple.com/fr/macosx/" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/www.apple.com/fr/macosx/?referer=');">Mac OS X</a></span>, <a href="http://www.glimpse-fr.org/developpement/preferences-application-cocoa/" onclick="pageTracker._trackPageview('/outgoing/www.glimpse-fr.org/developpement/preferences-application-cocoa/?referer=');">voici un didacticiel</a> pour apprendre à gérer les préférences d&#8217;une application <a href="http://fr.wikipedia.org/wiki/Cocoa_(Apple)" xml:lang="en" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/fr.wikipedia.org/wiki/Cocoa_Apple?referer=');">Cocoa</a>. Il est nécessaire d&#8217;avoir quelques (bonnes) notions en Objective-C, <a href="http://fr.wikipedia.org/wiki/Cocoa_(Apple)" xml:lang="en" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/fr.wikipedia.org/wiki/Cocoa_Apple?referer=');">Cocoa</a>, <span xml:lang="en">Xcode</span> et <span xml:lang="en">Interface Builder</span>. Attention : ce didacticiel n&#8217;explique pas comment faire un panneau pour les préférences système.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fruityfred.com/2008/09/30/gestion-des-preferences-dune-application-cocoa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XCode et InterfaceBuilder</title>
		<link>http://www.fruityfred.com/2008/07/21/xcode-et-interfacebuilder/</link>
		<comments>http://www.fruityfred.com/2008/07/21/xcode-et-interfacebuilder/#comments</comments>
		<pubDate>Sun, 20 Jul 2008 23:28:39 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[Développement]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Interface Builder]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[service web]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://www.glimpse-fr.org/?p=105</guid>
		<description><![CDATA[Je viens de rédiger un didacticiel sur la programmation sous Mac OS X, avec Xcode et InterfaceBuilder, qui sont les principaux outils de développement sous Mac (et livrés gratuitement avec le système). Lors du didacticiel, je détaille l&#8217;élaboration d&#8217;une petite interface graphique qui sert de frontal à un outil en ligne de commande pour générer [...]]]></description>
			<content:encoded><![CDATA[<p>Je viens de rédiger un didacticiel sur la programmation sous <span class="nobr"><a href="http://www.apple.com/fr/macosx/" hreflang="fr" onclick="pageTracker._trackPageview('/outgoing/www.apple.com/fr/macosx/?referer=');">Mac OS X</a></span>, avec <span xml:lang="en">Xcode</span> et InterfaceBuilder, qui sont les principaux outils de développement sous Mac (et livrés gratuitement avec le système). Lors du didacticiel, je détaille l&#8217;élaboration d&#8217;une petite interface graphique qui sert de frontal à un outil en ligne de commande pour générer les <a lang="en" hreflang="en" href="http://en.wikipedia.org/wiki/Stub_%28distributed_computing%29" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Stub_28distributed_computing_29?referer=');">stubs</a> d&#8217;un service web (<em>WSMakeStubs</em>). Ca se passe <a title="Aller au didacticiel Xcode et InterfaceBuilder" href="http://www.fruityfred.com/developpement/xcode-interfacebuilder/">ici</a> !<a href="http://www.fruityfred.com/developpement/xcode-interfacebuilder/"><br />
 </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fruityfred.com/2008/07/21/xcode-et-interfacebuilder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

