<?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>Webd &#187; Xcode</title>
	<atom:link href="http://webd.fr/tag/xcode/feed" rel="self" type="application/rss+xml" />
	<link>http://webd.fr</link>
	<description>Le blog de Julien Quéré</description>
	<lastBuildDate>Tue, 22 Mar 2011 15:49:19 +0000</lastBuildDate>
	<language>fr</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Nib2objc: Ou comment convertir un nib en code Objectif-C</title>
		<link>http://webd.fr/735-nib2objc-ou-comment-convertir-un-nib-en-code-objectif-c</link>
		<comments>http://webd.fr/735-nib2objc-ou-comment-convertir-un-nib-en-code-objectif-c#comments</comments>
		<pubDate>Wed, 10 Jun 2009 14:49:40 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Pro]]></category>
		<category><![CDATA[Cocoa Touch]]></category>
		<category><![CDATA[Developpement]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=735</guid>
		<description><![CDATA[L&#8217;utilisation d&#8217;Interface Builder s&#8217;avère très pratique pour les développeurs Cocoa Touch. C&#8217;est vrais que c&#8217;est génial de pouvoir créer ses interfaces en mode WYSIWYG. Oui mais voilà, cela peut poser quelques problèmes. Outre les cas où l&#8217;utilisation du code est &#8230; <a href="http://webd.fr/735-nib2objc-ou-comment-convertir-un-nib-en-code-objectif-c">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>L&#8217;utilisation d&#8217;Interface Builder s&#8217;avère très pratique pour les développeurs Cocoa Touch. C&#8217;est vrais que c&#8217;est génial de pouvoir créer ses interfaces en mode WYSIWYG. Oui mais voilà, cela peut poser quelques problèmes. Outre les cas où l&#8217;utilisation du code est nécessaire (pour atteindre la granularité voulue), on peut vouloir renoncer à l&#8217;utilisation des nibs pour des raisons de performance. </p>
<p>En effet, dans certains cas l&#8217;utilisation des nibs pose de sérieux problèmes de performance. On se retrouve ainsi avec un dur choix: soit on choisit la simplicité (et on utilise Interface Builder), soit on écrit ses interfaces directement dans le code et on gagne en performance. Dans certains cas, l&#8217;impact de l&#8217;utilisation des nibs sur la performance est quasi nul. La question ne se pose donc pas. Mais parfois, ce n&#8217;est pas le cas.<br />
<span id="more-735"></span><br />
Dans ce dernier cas de figure, il existe maintenant une solution: nib2objc. Ce projet Open-Source  est tout simplement un convertisseur de fichiers nib (.xib) vers du code Objectif-C. Il gère toutes les propriétés publiques de chacun des éléments graphiques, le constructeur et la hiérarchie des vues. Pour le moment, il n&#8217;y a que les composants d&#8217;UIKit qui sont supportés. L&#8217;utilisation est on-ne-peut-plus simple:</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('p735code3'); return false;">View Code</a> TEXT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p7353"><td class="code" id="p735code3"><pre class="text" style="font-family:monospace;">imac-de-julien-2:Debug julien$ ./nib2objc demo.xib &gt; demo.m</pre></td></tr></table></div>

<p><a href="http://webd.fr/wp-content/uploads/2009/06/image-6.png" rel="lightbox[735]" title="image-6"><img src="http://webd.fr/wp-content/uploads/2009/06/image-6-300x224.png" alt="image-6" title="image-6" width="300" height="224" class="aligncenter size-medium wp-image-738" /></a></p>
<p>Et voilà le résultat pour ce nib:</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('p735code4'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p7354"><td class="code" id="p735code4"><pre class="objc" style="font-family:monospace;">UILabel <span style="color: #002200;">*</span>view6 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UILabel alloc<span style="color: #002200;">&#93;</span> initWithFrame<span style="color: #002200;">:</span>CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">20.0</span>, <span style="color: #2400d9;">20.0</span>, <span style="color: #2400d9;">260.0</span>, <span style="color: #2400d9;">21.0</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
view6.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">20.0</span>, <span style="color: #2400d9;">20.0</span>, <span style="color: #2400d9;">260.0</span>, <span style="color: #2400d9;">21.0</span><span style="color: #002200;">&#41;</span>;
view6.adjustsFontSizeToFitWidth <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view6.alpha <span style="color: #002200;">=</span> <span style="color: #2400d9;">1.000</span>;
view6.autoresizingMask <span style="color: #002200;">=</span> UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;
view6.baselineAdjustment <span style="color: #002200;">=</span> UIBaselineAdjustmentAlignCenters;
view6.clearsContextBeforeDrawing <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view6.clipsToBounds <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view6.contentMode <span style="color: #002200;">=</span> UIViewContentModeScaleToFill;
view6.enabled <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view6.font <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIFont fontWithName<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Helvetica&quot;</span> size<span style="color: #002200;">:</span><span style="color: #2400d9;">17.000</span><span style="color: #002200;">&#93;</span>;
view6.hidden <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view6.lineBreakMode <span style="color: #002200;">=</span> UILineBreakModeTailTruncation;
view6.minimumFontSize <span style="color: #002200;">=</span> <span style="color: #2400d9;">10.000</span>;
view6.multipleTouchEnabled <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view6.numberOfLines <span style="color: #002200;">=</span> <span style="color: #2400d9;">1</span>;
view6.opaque <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view6.shadowOffset <span style="color: #002200;">=</span> CGSizeMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0.0</span>, <span style="color: #002200;">-</span><span style="color: #2400d9;">1.0</span><span style="color: #002200;">&#41;</span>;
view6.tag <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>;
view6.text <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Ma célule personalisée&quot;</span>;
view6.textAlignment <span style="color: #002200;">=</span> UITextAlignmentCenter;
view6.textColor <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIColor colorWithRed<span style="color: #002200;">:</span><span style="color: #2400d9;">0.000</span> green<span style="color: #002200;">:</span><span style="color: #2400d9;">0.000</span> blue<span style="color: #002200;">:</span><span style="color: #2400d9;">0.000</span> alpha<span style="color: #002200;">:</span><span style="color: #2400d9;">1.000</span><span style="color: #002200;">&#93;</span>;
view6.userInteractionEnabled <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
&nbsp;
UITableViewCell <span style="color: #002200;">*</span>view4 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UITableViewCell alloc<span style="color: #002200;">&#93;</span> initWithFrame<span style="color: #002200;">:</span>CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0.0</span>, <span style="color: #2400d9;">0.0</span>, <span style="color: #2400d9;">300.0</span>, <span style="color: #2400d9;">182.0</span><span style="color: #002200;">&#41;</span> reuseIdentifier<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>null<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
view4.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0.0</span>, <span style="color: #2400d9;">0.0</span>, <span style="color: #2400d9;">300.0</span>, <span style="color: #2400d9;">182.0</span><span style="color: #002200;">&#41;</span>;
view4.accessoryType <span style="color: #002200;">=</span> UITableViewCellAccessoryNone;
view4.alpha <span style="color: #002200;">=</span> <span style="color: #2400d9;">1.000</span>;
view4.autoresizingMask <span style="color: #002200;">=</span> UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;
view4.backgroundColor <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIColor colorWithRed<span style="color: #002200;">:</span><span style="color: #2400d9;">1.000</span> green<span style="color: #002200;">:</span><span style="color: #2400d9;">1.000</span> blue<span style="color: #002200;">:</span><span style="color: #2400d9;">1.000</span> alpha<span style="color: #002200;">:</span><span style="color: #2400d9;">1.000</span><span style="color: #002200;">&#93;</span>;
view4.clearsContextBeforeDrawing <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view4.clipsToBounds <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view4.contentMode <span style="color: #002200;">=</span> UIViewContentModeScaleToFill;
view4.font <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIFont fontWithName<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Helvetica&quot;</span> size<span style="color: #002200;">:</span><span style="color: #2400d9;">17.000</span><span style="color: #002200;">&#93;</span>;
view4.hidden <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view4.hidesAccessoryWhenEditing <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view4.indentationLevel <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>;
view4.indentationWidth <span style="color: #002200;">=</span> <span style="color: #2400d9;">10.000</span>;
view4.lineBreakMode <span style="color: #002200;">=</span> UILineBreakModeTailTruncation;
view4.multipleTouchEnabled <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view4.opaque <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view4.selectedTextColor <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIColor colorWithWhite<span style="color: #002200;">:</span><span style="color: #2400d9;">1.000</span> alpha<span style="color: #002200;">:</span><span style="color: #2400d9;">1.000</span><span style="color: #002200;">&#93;</span>;
view4.selectionStyle <span style="color: #002200;">=</span> UITableViewCellSelectionStyleBlue;
view4.showsReorderControl <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view4.tag <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>;
view4.textAlignment <span style="color: #002200;">=</span> UITextAlignmentLeft;
view4.textColor <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIColor colorWithWhite<span style="color: #002200;">:</span><span style="color: #2400d9;">0.000</span> alpha<span style="color: #002200;">:</span><span style="color: #2400d9;">1.000</span><span style="color: #002200;">&#93;</span>;
view4.userInteractionEnabled <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
&nbsp;
UIButton <span style="color: #002200;">*</span>view7 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIButton buttonWithType<span style="color: #002200;">:</span>UIButtonTypeRoundedRect<span style="color: #002200;">&#93;</span>;
view7.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">101.0</span>, <span style="color: #2400d9;">49.0</span>, <span style="color: #2400d9;">99.0</span>, <span style="color: #2400d9;">37.0</span><span style="color: #002200;">&#41;</span>;
view7.adjustsImageWhenDisabled <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view7.adjustsImageWhenHighlighted <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view7.alpha <span style="color: #002200;">=</span> <span style="color: #2400d9;">1.000</span>;
view7.autoresizingMask <span style="color: #002200;">=</span> UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;
view7.clearsContextBeforeDrawing <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view7.clipsToBounds <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view7.contentHorizontalAlignment <span style="color: #002200;">=</span> UIControlContentHorizontalAlignmentCenter;
view7.contentMode <span style="color: #002200;">=</span> UIViewContentModeScaleToFill;
view7.contentVerticalAlignment <span style="color: #002200;">=</span> UIControlContentVerticalAlignmentCenter;
view7.enabled <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view7.font <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIFont fontWithName<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Helvetica-Bold&quot;</span> size<span style="color: #002200;">:</span><span style="color: #2400d9;">15.000</span><span style="color: #002200;">&#93;</span>;
view7.hidden <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view7.highlighted <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view7.multipleTouchEnabled <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view7.opaque <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view7.reversesTitleShadowWhenHighlighted <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view7.selected <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view7.showsTouchWhenHighlighted <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view7.tag <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>;
view7.titleShadowOffset <span style="color: #002200;">=</span> CGSizeMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">1.0</span>, <span style="color: #2400d9;">1.0</span><span style="color: #002200;">&#41;</span>;
view7.userInteractionEnabled <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
<span style="color: #002200;">&#91;</span>view7 setTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Un bouton&quot;</span> forState<span style="color: #002200;">:</span>UIControlStateNormal<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>view7 setTitleColor<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>UIColor colorWithWhite<span style="color: #002200;">:</span><span style="color: #2400d9;">1.000</span> alpha<span style="color: #002200;">:</span><span style="color: #2400d9;">1.000</span><span style="color: #002200;">&#93;</span> forState<span style="color: #002200;">:</span>UIControlStateHighlighted<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>view7 setTitleColor<span style="color: #002200;">:</span>NSPatternColorSpace <a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSImage_Class/"><span style="color: #400080;">NSImage</span></a> 0x2c3e5a0 Size<span style="color: #002200;">=</span><span style="color: #002200;">&#123;</span><span style="color: #2400d9;">320</span>, <span style="color: #2400d9;">460</span><span style="color: #002200;">&#125;</span> Reps<span style="color: #002200;">=</span><span style="color: #002200;">&#40;</span>
    <a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSBitmapImageRep_Class/"><span style="color: #400080;">NSBitmapImageRep</span></a> 0x2c49460 Size<span style="color: #002200;">=</span><span style="color: #002200;">&#123;</span><span style="color: #2400d9;">320</span>, <span style="color: #2400d9;">460</span><span style="color: #002200;">&#125;</span> ColorSpace<span style="color: #002200;">=</span>NSDeviceRGBColorSpace BPS<span style="color: #002200;">=</span><span style="color: #2400d9;">8</span> BPP<span style="color: #002200;">=</span><span style="color: #2400d9;">32</span> Pixels<span style="color: #002200;">=</span>320x460 Alpha<span style="color: #002200;">=</span><span style="color: #a61390;">YES</span> Planar<span style="color: #002200;">=</span><span style="color: #a61390;">NO</span> Format<span style="color: #002200;">=</span><span style="color: #2400d9;">1</span>
<span style="color: #002200;">&#41;</span> forState<span style="color: #002200;">:</span>UIControlStateNormal<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>view7 setTitleShadowColor<span style="color: #002200;">:</span>NSNamedColorSpace System controlColor forState<span style="color: #002200;">:</span>UIControlStateNormal<span style="color: #002200;">&#93;</span>;
&nbsp;
UISwitch <span style="color: #002200;">*</span>view8 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UISwitch alloc<span style="color: #002200;">&#93;</span> initWithFrame<span style="color: #002200;">:</span>CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">103.0</span>, <span style="color: #2400d9;">103.0</span>, <span style="color: #2400d9;">94.0</span>, <span style="color: #2400d9;">27.0</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
view8.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">103.0</span>, <span style="color: #2400d9;">103.0</span>, <span style="color: #2400d9;">94.0</span>, <span style="color: #2400d9;">27.0</span><span style="color: #002200;">&#41;</span>;
view8.alpha <span style="color: #002200;">=</span> <span style="color: #2400d9;">1.000</span>;
view8.autoresizingMask <span style="color: #002200;">=</span> UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;
view8.clearsContextBeforeDrawing <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view8.clipsToBounds <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view8.contentHorizontalAlignment <span style="color: #002200;">=</span> UIControlContentHorizontalAlignmentCenter;
view8.contentMode <span style="color: #002200;">=</span> UIViewContentModeScaleToFill;
view8.contentVerticalAlignment <span style="color: #002200;">=</span> UIControlContentVerticalAlignmentCenter;
view8.enabled <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view8.hidden <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view8.highlighted <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view8.multipleTouchEnabled <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view8.on <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view8.opaque <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view8.selected <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view8.tag <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>;
view8.userInteractionEnabled <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
&nbsp;
<span style="color: #002200;">&#91;</span>view4 addSubview<span style="color: #002200;">:</span>view6<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>view4 addSubview<span style="color: #002200;">:</span>view7<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>view4 addSubview<span style="color: #002200;">:</span>view8<span style="color: #002200;">&#93;</span>;</pre></td></tr></table></div>

<p>Comme vous pouvez le voir, c&#8217;est très verbeux. C&#8217;est parce que l&#8217;outil ne détecte pas les valeurs qui sont là par défaut. Donc dans le doute, il génère toutes les propriétés. A noter aussi que les valeurs des propriétés <code>UIImage</code>, <code>NSLocale</code> et <code>NSTimeZone</code> ne sont pas sorties dans le code. En effet, ibtool (sur lequel nib2objc se base) ne les supporte pas. </p>
<p><a href="http://kosmaczewski.net/projects/nib2objc/">Plus d&#8217;informations sur la page du projet nib2objc du site d&#8217;Adrian Kosmaczewski</a>. <!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/735-nib2objc-ou-comment-convertir-un-nib-en-code-objectif-c/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Astuces développement iPhone 8: Modifier le __MyCompanyName__</title>
		<link>http://webd.fr/707-developpement-iphone-modifier-le-__mycompanyname__</link>
		<comments>http://webd.fr/707-developpement-iphone-modifier-le-__mycompanyname__#comments</comments>
		<pubDate>Tue, 02 Jun 2009 08:12:37 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[Developpement]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=707</guid>
		<description><![CDATA[Je vois assez souvent, dans les fichiers de code qui passent entre mes mains, des en-têtes comme ceci: ?View Code OBJC// Created by Julien on 17/01/09. // Copyright 2009 __MyCompanyName__. All rights reserved. Le problème porte sur __MyCompanyName__. Il serait &#8230; <a href="http://webd.fr/707-developpement-iphone-modifier-le-__mycompanyname__">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Je vois assez souvent, dans les fichiers de code qui passent entre mes mains, des en-têtes comme ceci:</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('p707code7'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p7077"><td class="code" id="p707code7"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">//  Created by Julien on 17/01/09.</span>
<span style="color: #11740a; font-style: italic;">//  Copyright 2009 __MyCompanyName__. All rights reserved.</span></pre></td></tr></table></div>

<p>Le problème porte sur <code>__MyCompanyName__</code>. Il serait bien plus propre de le remplacer par une valeur personnalisée (et automatique de préférence). Pour ceci, Apple a tout prévu &#8230;<br />
<span id="more-707"></span><br />
Il suffit tout simplement de modifier <code>ORGANIZATIONNAME</code> de <code>PBXCustomTemplateMacroDefinitions</code> dans la configuration de Xcode. En ligne de commande, ça donne (dans mon cas):</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('p707code8'); return false;">View Code</a> TEXT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p7078"><td class="code" id="p707code8"><pre class="text" style="font-family:monospace;">defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions {&quot;ORGANIZATIONNAME&quot;=&quot;Julien Quéré - http://webd.fr&quot;;}'</pre></td></tr></table></div>

<p><!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/707-developpement-iphone-modifier-le-__mycompanyname__/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Astuces développement iPhone 6: Récupérer l&#8217;UDID</title>
		<link>http://webd.fr/526-astuces-developpement-iphone-6-recuperer-ludid</link>
		<comments>http://webd.fr/526-astuces-developpement-iphone-6-recuperer-ludid#comments</comments>
		<pubDate>Mon, 11 May 2009 09:14:54 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[Developpement]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=526</guid>
		<description><![CDATA[Il peut être utile, dans une application, de connaître l'UDID de façon logicielle. Ainsi, on identifie de façon unique et certaine l'équipement sur lequel notre application s'exécute. Pour récupérer l'UDID, rien de plus simple ... <a href="http://webd.fr/526-astuces-developpement-iphone-6-recuperer-ludid">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>L&#8217;UDID (<i>Universal Device Identifier</i>) d&#8217;un iPhone est, comme son nom l&#8217;indique, un identifiant unique pour chaque iPhone / iPod. Si vous avez déjà eu à générer des fichiers de provisioning, vous connaissez bien cet identifiant. En effet, c&#8217;est ce dernier que l&#8217;on doit transmettre à Apple quand on veut rajouter un iPhone / iPod dans la liste des appareils autorisés pour un développement ou une distribution. </p>
<p>Il peut être utile, dans une application, de connaître ce fameux UDID de façon logicielle. Ainsi, on identifie de façon unique et certaine l&#8217;équipement sur lequel notre application s&#8217;exécute. Pour récupérer l&#8217;UDID, rien de plus simple:</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('p526code9'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5269"><td class="code" id="p526code9"><pre class="objc" style="font-family:monospace;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>udid <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIDevice currentDevice<span style="color: #002200;">&#93;</span> uniqueIdentifier<span style="color: #002200;">&#93;</span>;</pre></td></tr></table></div>

<p><!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/526-astuces-developpement-iphone-6-recuperer-ludid/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Astuces développement iPhone 5: whatis et ptype</title>
		<link>http://webd.fr/388-astuces-developpement-iphone-5-whatis-et-ptype</link>
		<comments>http://webd.fr/388-astuces-developpement-iphone-5-whatis-et-ptype#comments</comments>
		<pubDate>Wed, 06 May 2009 09:02:38 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[Developpement]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=388</guid>
		<description><![CDATA[Dans la même veine que le Print Object en console, voici une nouvelle astuce en console de debug. L&#8217;idée n&#8217;est plus de récupérer la description d&#8217;un objet, mais son type. Ainsi, il y a deux commandes: whatis et ptype. La &#8230; <a href="http://webd.fr/388-astuces-developpement-iphone-5-whatis-et-ptype">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Dans la même veine que le <a href="http://webd.fr/385-astuces-developpement-iphone-2-print-object-en-console">Print Object en console</a>, voici une nouvelle astuce en console de debug. L&#8217;idée n&#8217;est plus de récupérer la description d&#8217;un objet, mais son type. Ainsi, il y a deux commandes: <code>whatis</code> et <code>ptype</code>. La première permets d&#8217;avoir simplement le type d&#8217;un objet. Ainsi, si on a un objet <code>monDico</code> de type <code>NSMutableDictionary</code>, voilà ce que l&#8217;on obtient avec <code>whatis</code>:</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('p388code14'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p38814"><td class="code" id="p388code14"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#40;</span>gdb<span style="color: #002200;">&#41;</span> whatis monDico
type <span style="color: #002200;">=</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableDictionary_Class/"><span style="color: #400080;">NSMutableDictionary</span></a> <span style="color: #002200;">*</span></pre></td></tr></table></div>

<p><code>ptype</code>, quant à lui est beaucoup plus complet. Si on reprends le même exemple, voilà ce que l&#8217;on obtient:</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('p388code15'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p38815"><td class="code" id="p388code15"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#40;</span>gdb<span style="color: #002200;">&#41;</span> ptype monDico
type <span style="color: #002200;">=</span> class <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableDictionary_Class/"><span style="color: #400080;">NSMutableDictionary</span></a> <span style="color: #002200;">:</span> public <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/"><span style="color: #400080;">NSDictionary</span></a> <span style="color: #002200;">&#123;</span>
<span style="color: #002200;">&#125;</span> <span style="color: #002200;">*</span></pre></td></tr></table></div>

<p>Là où <code>ptype</code> prends tout son intérêt, c&#8217;est sur les types personnalisés. Voici deux exemple concret avec des objet perso:</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('p388code16'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p38816"><td class="code" id="p388code16"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#40;</span>gdb<span style="color: #002200;">&#41;</span> ptype currentRdv
type <span style="color: #002200;">=</span> class MiniRdv <span style="color: #002200;">:</span> public <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/"><span style="color: #400080;">NSObject</span></a> <span style="color: #002200;">&#123;</span>
  protected<span style="color: #002200;">:</span>
    <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>startDateFormated;
    <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>startTimeFormated;
    <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>title;
    <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>personName;
    <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>personFirstName;
    <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>personPhoneBookId;
    NSInteger dbId;
<span style="color: #002200;">&#125;</span> <span style="color: #002200;">*</span></pre></td></tr></table></div>


<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('p388code17'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p38817"><td class="code" id="p388code17"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#40;</span>gdb<span style="color: #002200;">&#41;</span> ptype cell
type <span style="color: #002200;">=</span> class RdvTableCell <span style="color: #002200;">:</span> public UITableViewCell <span style="color: #002200;">&#123;</span>
  protected<span style="color: #002200;">:</span>
    MiniRdv <span style="color: #002200;">*</span>miniRdvObject;
    UILabel <span style="color: #002200;">*</span>topLeftLabel;
    UILabel <span style="color: #002200;">*</span>bottomLeftLabel;
    UILabel <span style="color: #002200;">*</span>bottomRightLabel;
    UILabel <span style="color: #002200;">*</span>topRightLabel;
    UIImageView <span style="color: #002200;">*</span>avatar;
<span style="color: #002200;">&#125;</span> <span style="color: #002200;">*</span></pre></td></tr></table></div>

<p>Bref, <code>ptype</code> est un outil indispensable au debug d&#8217;applications !<!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/388-astuces-developpement-iphone-5-whatis-et-ptype/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Astuces développement iPhone 4: Récupérer le nom de l&#8217;iPhone</title>
		<link>http://webd.fr/420-astuces-developpement-iphone-4-recuperer-le-nom-de-liphone</link>
		<comments>http://webd.fr/420-astuces-developpement-iphone-4-recuperer-le-nom-de-liphone#comments</comments>
		<pubDate>Fri, 01 May 2009 07:56:02 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[Developpement]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=420</guid>
		<description><![CDATA[Il peut être très utile de récupérer le nom de l&#8217;iPhone sur lequel notre application s&#8217;exécute (comme iPhone-de-julien). C&#8217;est le cas notamment dans des applications où on appaire deux iPhone au travers d&#8217;un réseau WiFi (par exemple). L&#8217;idée est très &#8230; <a href="http://webd.fr/420-astuces-developpement-iphone-4-recuperer-le-nom-de-liphone">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Il peut être très utile de récupérer le nom de l&#8217;iPhone sur lequel notre application s&#8217;exécute (comme <cite>iPhone-de-julien</cite>). C&#8217;est le cas notamment dans des applications où on appaire deux iPhone au travers d&#8217;un réseau WiFi (par exemple). L&#8217;idée est très simple: on récupère les informations de l&#8217;hôte courant, puis on prend le premier de ses noms. Ce qui donne au final:</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('p420code19'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p42019"><td class="code" id="p420code19"><pre class="objc" style="font-family:monospace;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>deviceName <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSHost_Class/"><span style="color: #400080;">NSHost</span></a> currentHost<span style="color: #002200;">&#93;</span> names<span style="color: #002200;">&#93;</span> objectAtIndex<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span>;</pre></td></tr></table></div>

<p><!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/420-astuces-developpement-iphone-4-recuperer-le-nom-de-liphone/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Astuces développement iPhone 3: Executer un code seulement sur le simulateur</title>
		<link>http://webd.fr/415-iphone-executer-code-seulement-le-simulateur</link>
		<comments>http://webd.fr/415-iphone-executer-code-seulement-le-simulateur#comments</comments>
		<pubDate>Mon, 27 Apr 2009 09:14:00 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[Developpement]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=415</guid>
		<description><![CDATA[Il peut être utile parfois de n&#8217;exécuter certains codes que dans le simulateur (ou à l&#8217;inverse: seulement sur un véritable iPhone). Concrètement, c&#8217;est le cas quand on utilise des fonctionnalités non présentes sur le simulateur (accéléromètre par exemple). Pour ce &#8230; <a href="http://webd.fr/415-iphone-executer-code-seulement-le-simulateur">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Il peut être utile parfois de n&#8217;exécuter certains codes que dans le simulateur (ou à l&#8217;inverse: seulement sur un véritable iPhone). Concrètement, c&#8217;est le cas quand on utilise des fonctionnalités non présentes sur le simulateur (accéléromètre par exemple). Pour ce faire, il suffit d&#8217;inclure le code a exécuter sur simulateur entre des directives de compilateur:</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('p415code21'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p41521"><td class="code" id="p415code21"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#if TARGET_IPHONE_SIMULATOR</span>
  NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Bonjour, je suis sir le simulateur&quot;</span><span style="color: #002200;">&#41;</span>;
<span style="color: #6e371a;">#else</span>
  NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Bonjour, je suis sur un véritable iPhone !&quot;</span><span style="color: #002200;">&#41;</span>;
<span style="color: #6e371a;">#endif</span></pre></td></tr></table></div>

<p><!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/415-iphone-executer-code-seulement-le-simulateur/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Astuces développement iPhone 2: Print Object en console</title>
		<link>http://webd.fr/385-astuces-developpement-iphone-2-print-object-en-console</link>
		<comments>http://webd.fr/385-astuces-developpement-iphone-2-print-object-en-console#comments</comments>
		<pubDate>Mon, 20 Apr 2009 08:30:24 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[Developpement]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=385</guid>
		<description><![CDATA[Je me suis très souvent posé la question suivante: Mais pourquoi ça ne marche pas ? Qu&#8217;est ce qu&#8217;il y a dans cet objet ?. Le fait est que ce n&#8217;est pas très facile de répondre à cette question avec &#8230; <a href="http://webd.fr/385-astuces-developpement-iphone-2-print-object-en-console">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Je me suis très souvent posé la question suivante: <cite>Mais pourquoi ça ne marche pas ? Qu&#8217;est ce qu&#8217;il y a dans cet objet ?</cite>. Le fait est que ce n&#8217;est pas très facile de répondre à cette question avec l&#8217;interface de débogage de Xcode. Par contre dans la console de debug, il y a une commande magnifique … </p>
<p>Il s&#8217;agit tout simplement de <code>po</code> (pour <i>Print Object</i>). Pour l&#8217;utiliser, rien de plus simple: mettez un point d&#8217;arrêt là où vous voulez voir ce que contient un objet. Ensuite, faites un simple <code>po monObjet</code>. Par exemple, créons un <code>NSMutableDictionary</code> …</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('p385code24'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p38524"><td class="code" id="p385code24"><pre class="objc" style="font-family:monospace;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableDictionary_Class/"><span style="color: #400080;">NSMutableDictionary</span></a> <span style="color: #002200;">*</span> monDico <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableDictionary_Class/"><span style="color: #400080;">NSMutableDictionary</span></a> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>monDico setObject<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;objet1&quot;</span> forKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;clef1&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>monDico setObject<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;objet2&quot;</span> forKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;clef2&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>monDico setObject<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;objet3&quot;</span> forKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;clef3&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>monDico setObject<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;objet4&quot;</span> forKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;clef4&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>monDico setObject<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;objet5&quot;</span> forKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;clef5&quot;</span><span style="color: #002200;">&#93;</span>;</pre></td></tr></table></div>

<p>Et voilà ce que nous renvoie la console après un <code>po monDico</code></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('p385code25'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p38525"><td class="code" id="p385code25"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#40;</span>gdb<span style="color: #002200;">&#41;</span> po monDico
<span style="color: #002200;">&#123;</span>
    clef1 <span style="color: #002200;">=</span> objet1;
    clef2 <span style="color: #002200;">=</span> objet2;
    clef3 <span style="color: #002200;">=</span> objet3;
    clef4 <span style="color: #002200;">=</span> objet4;
    clef5 <span style="color: #002200;">=</span> objet5;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>En fait, <code>po</code> fait appel à la méthode <code>description</code> de l&#8217;objet. Toutes les classes Cocoa de base implémentent cette méthode. Pour les classes personnelles, il vous suffit d&#8217;implémenter le protocole suivant: <code>- (NSString *)description;</code>.<!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/385-astuces-developpement-iphone-2-print-object-en-console/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Astuces développement iPhone 1: Quelques raccourcis claviers</title>
		<link>http://webd.fr/378-astuces-developpement-iphone-1-quelques-raccourcis-claviers</link>
		<comments>http://webd.fr/378-astuces-developpement-iphone-1-quelques-raccourcis-claviers#comments</comments>
		<pubDate>Mon, 13 Apr 2009 09:06:59 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[Developpement]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=378</guid>
		<description><![CDATA[Au cours de mes développements iPhone, il y a plein de petites astuces que je découvre. Des petites choses toute bêtes, mais elles peuvent faire gagner pas mal de temps et de confort quand on les utilise les uns à &#8230; <a href="http://webd.fr/378-astuces-developpement-iphone-1-quelques-raccourcis-claviers">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Au cours de mes développements iPhone, il y a plein de petites astuces que je découvre. Des petites choses toute bêtes, mais elles peuvent faire gagner pas mal de temps et de confort quand on les utilise les uns à la suite des autres. Voilà pourquoi je pense lancer une série de billets où je présenterais les astuces découvertes au fil du temps. </p>
<p>Commençons donc par quelques raccourcis claviers découverts récemment qui me font gagner pas mal de temps: </p>
<ul>
<li><b>Option et double clic</b>: affiche la documentation pour ce qui se trouve sous le curseur (si la documentation existe bien évidement). </li>
<li><b>Commande et double clic</b>: envoie vers la définition (dans le .h) de ce qui se trouve sous le curseur.</li>
<li><b>Commande-Option-Haut</b>: permets de switcher entre le fichier d&#8217;en-tête (.h) et de code (.m) et vice-versa.</li>
<li><b>Commande-B</b>: lance la compilation du projet.</li>
<li><b>Commande-Retour</b>: compile le projet et le lance.</li>
</ul>
<p>Sinon, pour ceux qui veulent un grand poster, il y a l&#8217;image faite par <a href="http://cocoasamurai.blogspot.com/2008/02/complete-xcode-keyboard-shortcut-list.html">Colin Wheeler de Cocoa Samurai</a>. Elle est très (trop ?) complète:</p>
<p><a href="http://webd.fr/wp-content/uploads/2009/04/xcode-shortcuts.png" rel="lightbox[378]" title="xcode-shortcuts"><img src="http://webd.fr/wp-content/uploads/2009/04/xcode-shortcuts-290x300.png" alt="xcode-shortcuts" title="xcode-shortcuts" width="290" height="300" class="aligncenter size-medium wp-image-381" /></a></p>
<p>A bientôt (certainement) pour de nouvelles astuces … </p>
<p><!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/378-astuces-developpement-iphone-1-quelques-raccourcis-claviers/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

