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

<channel>
	<title>Blog d&#039;un développeur multi-support &#187; débutant</title>
	<atom:link href="http://www.oni-ecchi.info/blog/tag/debutant/feed" rel="self" type="application/rss+xml" />
	<link>http://www.oni-ecchi.info/blog</link>
	<description>[DIM] pour les intimes :)</description>
	<lastBuildDate>Mon, 06 Feb 2012 18:51:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Iphone &amp; UIButton &amp; Multilangue</title>
		<link>http://www.oni-ecchi.info/blog/iphone/iphone-uibutton-multilangue.html</link>
		<comments>http://www.oni-ecchi.info/blog/iphone/iphone-uibutton-multilangue.html#comments</comments>
		<pubDate>Sun, 08 Mar 2009 14:47:48 +0000</pubDate>
		<dc:creator>Guillaume chave</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[débutant]]></category>
		<category><![CDATA[multi langue]]></category>
		<category><![CDATA[navigation]]></category>
		<category><![CDATA[tutoriel]]></category>

		<guid isPermaLink="false">http://www.oni-ecchi.info/blog/?p=307</guid>
		<description><![CDATA[Vaste programme pour ce billet :) En fait nous allons modifier un bouton en fonction de la langue du téléphone. Et nous allons créer un état &#171;&#160;survolé&#160;&#187; à notre bouton par programmation. InterfaceBuilder n&#8217;étant pas très clair sur cette manipulation. Tout d&#8217;abord il nous faut un UIButton déclaré en tant que IBOutlet UIButton dans notre [...]]]></description>
			<content:encoded><![CDATA[<p>Vaste programme pour ce billet :) En fait nous allons modifier un bouton en fonction de la langue du téléphone.<br />
Et nous allons créer un état &laquo;&nbsp;survolé&nbsp;&raquo; à notre bouton par programmation. InterfaceBuilder n&#8217;étant pas très clair sur cette manipulation.</p>
<p>Tout d&#8217;abord il nous faut un UIButton déclaré en tant que IBOutlet UIButton dans notre classe. Puis nous relions ce bouton via InterfaceBuilder avec un bouton sur notre vue. Dans les propriétés de celui ci vous pouvez dire que c&#8217;est un &laquo;&nbsp;custom button&nbsp;&raquo;. Faites le. Et nous revenons à XCode : </p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p307code2'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3072"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
</pre></td><td class="code" id="p307code2"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>viewDidLoad
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// Gestion du multilanguage</span>
	NSUserDefaults<span style="color: #339933;">*</span> defs <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>NSUserDefaults standardUserDefaults<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	NSArray<span style="color: #339933;">*</span> languages <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>defs objectForKey<span style="color: #339933;">:</span>@<span style="color: #ff0000;">&quot;AppleLanguages&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// preferredLang vaut &quot;fr&quot;, &quot;en&quot;, &quot;de&quot;, etc </span>
	preferredLang <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>languages objectAtIndex<span style="color: #339933;">:</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Méthode avec deux jeux de langues : Française ou Anglaise dans les autres langues </span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>preferredLang isEqualToString<span style="color: #339933;">:</span>@<span style="color: #ff0000;">&quot;fr&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		UIImage <span style="color: #339933;">*</span> higlight <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>UIImage imageNamed<span style="color: #339933;">:</span>@<span style="color: #ff0000;">&quot;fr_btn_clik.png&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#91;</span>btnTest setBackgroundImage<span style="color: #339933;">:</span>higlight forState<span style="color: #339933;">:</span>UIControlStateHighlighted<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#91;</span>higlight release<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
		UIImage <span style="color: #339933;">*</span> normal <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>UIImage imageNamed<span style="color: #339933;">:</span>@<span style="color: #ff0000;">&quot;fr_btn.png&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#91;</span>btnTest setBackgroundImage<span style="color: #339933;">:</span>normal forState<span style="color: #339933;">:</span>UIControlStateNormal<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#91;</span>normal release<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">else</span> 
	<span style="color: #009900;">&#123;</span>
		UIImage <span style="color: #339933;">*</span> higlight <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>UIImage imageNamed<span style="color: #339933;">:</span>@<span style="color: #ff0000;">&quot;en_btn_clik.png&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#91;</span>btnTest setBackgroundImage<span style="color: #339933;">:</span>higlight forState<span style="color: #339933;">:</span>UIControlStateHighlighted<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#91;</span>higlight release<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
		UIImage <span style="color: #339933;">*</span> normal <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>UIImage imageNamed<span style="color: #339933;">:</span>@<span style="color: #ff0000;">&quot;en_btn.png&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#91;</span>btnTest setBackgroundImage<span style="color: #339933;">:</span>normal forState<span style="color: #339933;">:</span>UIControlStateNormal<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#91;</span>normal release<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Mais nous pouvons aussi concaténer le code langue avec le chemin de l'image.</span>
	<span style="color: #666666; font-style: italic;">// dans ce cas là il nous faut autant d'image que de langue possibles.</span>
	NSString <span style="color: #339933;">*</span> pathImage <span style="color: #339933;">=</span> @<span style="color: #ff0000;">&quot;_btn.png&quot;</span><span style="color: #339933;">;</span>
	NSString <span style="color: #339933;">*</span> pathImageClik <span style="color: #339933;">=</span> @<span style="color: #ff0000;">&quot;_btn_clik.png&quot;</span><span style="color: #339933;">;</span>
	UIImage <span style="color: #339933;">*</span> higlight <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>UIImage imageNamed<span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span>pathImage stringByAppendingString<span style="color: #339933;">:</span>preferredLang <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#91;</span>btnTest setBackgroundImage<span style="color: #339933;">:</span>higlight forState<span style="color: #339933;">:</span>UIControlStateHighlighted<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#91;</span>higlight release<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	UIImage <span style="color: #339933;">*</span> normal <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>UIImage imageNamed<span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span>pathImageClik stringByAppendingString<span style="color: #339933;">:</span>preferredLang <span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#91;</span>btnTest setBackgroundImage<span style="color: #339933;">:</span>normal forState<span style="color: #339933;">:</span>UIControlStateNormal<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#91;</span>normal release<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Simple non ?</p>
<p>Après c&#8217;est sur cette méthode est un peu lourde. Il faut autant d&#8217;images que de langage et on n&#8217;utilise pas les techniques Apple pour le multilangue (avec leurs histoire de Bundle par langue, un dictionnaire de traductions etc).</p>
<p>Cependant, si comme vous avez affaire à des boutons très personnalisés (typo exotique, disposition du texte particuliere), il est peut être plus rapide de tout passer en image comme ici.</p>
<p>Chacun fait comme il le sent après ^^</p>
]]></content:encoded>
			<wfw:commentRss>http://www.oni-ecchi.info/blog/iphone/iphone-uibutton-multilangue.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>iPhone &amp; UIView</title>
		<link>http://www.oni-ecchi.info/blog/iphone/iphone-uiview.html</link>
		<comments>http://www.oni-ecchi.info/blog/iphone/iphone-uiview.html#comments</comments>
		<pubDate>Sun, 08 Mar 2009 12:58:19 +0000</pubDate>
		<dc:creator>Guillaume chave</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[débutant]]></category>
		<category><![CDATA[tutoriel]]></category>
		<category><![CDATA[UIView]]></category>

		<guid isPermaLink="false">http://www.oni-ecchi.info/blog/?p=288</guid>
		<description><![CDATA[Connaissez vous l&#8217;attribut &#171;&#160;tag&#160;&#187; d&#8217;une UIView ? Cette propriété sert à différencier les vues les unes des autres. Il s&#8217;agit d&#8217;un entier qui, par défaut, est géré par l&#8217;iphone. Mais on peut la fixer à la main et cela permet quelque liberté. En voici une utilisation : Admettons que vous avez une vue centrale qui [...]]]></description>
			<content:encoded><![CDATA[<p>Connaissez vous l&#8217;attribut &laquo;&nbsp;tag&nbsp;&raquo; d&#8217;une UIView ?</p>
<p>Cette propriété sert à différencier les vues les unes des autres. Il s&#8217;agit d&#8217;un entier qui, par défaut, est géré par l&#8217;<a href="http://www.oni-ecchi.info/blog/tag/iphone" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec iPhone">iphone</a>. Mais on peut la fixer à la main et cela permet quelque liberté. En voici une utilisation :</p>
<p>Admettons que vous avez une vue centrale qui sert de menu en &laquo;&nbsp;footer&nbsp;&raquo; et que vous n&#8217;utilisez pas les composants de navigations par défaut du téléphone.</p>
<p>Lors d&#8217;un clic sur un bouton du menu &laquo;&nbsp;footer&nbsp;&raquo;, vous allez ajouter une nouvelle vue par dessus votre écran principal en laissant le footer de la vue principal visible. Seulement voilà, à chaque clic sur un bouton du menu, vous allez superposer une vue à chaque fois. Question performance c&#8217;est pas tip top.</p>
<p>Alors une première approche est déjà de faire un bouton retour dans la nouvelle vue comme ceci :</p>

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

<p>Mais bon rien n&#8217;empêche l&#8217;utilisateur de clicker sur les éléments du footer au lieu de faire retour. Notez que même si cette nouvelle vue est ajouté par dessus la principale et la masque complètement, les autres boutons de la vue principale sont encore actifs. Sauf si on les désactive lors du click sur le bouton et qu&#8217;on les réactives lors de l&#8217;action &laquo;&nbsp;back&nbsp;&raquo; précédemment crée, via une méthode delegate.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p288code8'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2888"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code" id="p288code8"><pre class="c" style="font-family:monospace;">&nbsp;
<span style="color: #666666; font-style: italic;">// Dans la vue qui se superpose</span>
<span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span>IBAction<span style="color: #009900;">&#41;</span>back <span style="color: #009900;">&#123;</span>
	NSLog<span style="color: #009900;">&#40;</span>@<span style="color: #ff0000;">&quot;back&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#91;</span>self.<span style="color: #202020;">delegate</span> RetourMenu<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#91;</span>self.<span style="color: #202020;">view</span> removeFromSuperview<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Dans la vue principale</span>
<span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>RetourMenu
<span style="color: #009900;">&#123;</span>
	NSLog<span style="color: #009900;">&#40;</span>@<span style="color: #ff0000;">&quot;Réactivation des boutons &quot;</span>cachés<span style="color: #ff0000;">&quot; par la nouvelle superposés&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	btnVue1.<span style="color: #202020;">enabled</span> <span style="color: #339933;">=</span> YES<span style="color: #339933;">;</span>
	btnVue2.<span style="color: #202020;">enabled</span> <span style="color: #339933;">=</span> YES<span style="color: #339933;">;</span>
	btnVue3.<span style="color: #202020;">enabled</span> <span style="color: #339933;">=</span> YES<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Il faut maintenant gérer les vues afin d&#8217;éviter les superposements inutiles. Ceci se fait via la propriété tag. Personnellement j&#8217;ai définit le tag de ma vue principal à 100 via Interface Builder. Mais je pense qu&#8217;un self.tag = 100 dans le viewDidLoad marche aussi.</p>
<p>Puis voici comment je change de vue : </p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p288code9'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2889"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
</pre></td><td class="code" id="p288code9"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span>IBAction<span style="color: #009900;">&#41;</span>ClickMenu<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// Vide l'écran de toutes vues, sauf celle de l'écran principale</span>
	NSArray <span style="color: #339933;">*</span>subviews <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>self.<span style="color: #202020;">view</span> superview<span style="color: #009900;">&#93;</span> subviews<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	UIView <span style="color: #339933;">*</span>view<span style="color: #339933;">;</span>
	<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>view in subviews<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Le tag 100 correspond à la vue &quot;Menu Principale&quot;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>view.<span style="color: #202020;">tag</span> <span style="color: #339933;">!=</span> <span style="color: #0000dd;">100</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #009900;">&#91;</span>view removeFromSuperview<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #666666; font-style: italic;">// Définit la vue courante et le gestionnaire d'évènement de MaVueSuivante</span>
	MaVueSuivante<span style="color: #339933;">*</span>myView <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>MaVueSuivantealloc<span style="color: #009900;">&#93;</span> initWithNibName<span style="color: #339933;">:</span>@<span style="color: #ff0000;">&quot;MaVueSuivanteNib&quot;</span> bundle<span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span>NSBundle mainBundle<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	myView.<span style="color: #202020;">delegate</span> <span style="color: #339933;">=</span> self<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Recupère le singleton de l'application courante</span>
	MonProjetAppDelegate <span style="color: #339933;">*</span>app <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>Lacoste_0_MonProjetAppDelegate <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>UIApplication sharedApplication<span style="color: #009900;">&#93;</span> delegate<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#91;</span>app.<span style="color: #202020;">window</span> addSubview<span style="color: #339933;">:</span>myView.<span style="color: #202020;">view</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Désactivation des boutons &quot;cachés&quot; par la nouvelle vue</span>
	btnVue1.<span style="color: #202020;">enabled</span> <span style="color: #339933;">=</span> NO<span style="color: #339933;">;</span>
	btnVue2.<span style="color: #202020;">enabled</span> <span style="color: #339933;">=</span> NO<span style="color: #339933;">;</span>
	btnVue3.<span style="color: #202020;">enabled</span> <span style="color: #339933;">=</span> NO<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Simple non ?</p>
<p>Enfin pour rendre une vue par dessus une autre tout en gardant la vue principal visible j&#8217;utilise la propriété &laquo;&nbsp;bounds&nbsp;&raquo; de la vue à afficher comme ceci :</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p288code10'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p28810"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p288code10"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>viewDidLoad
<span style="color: #009900;">&#123;</span>
	view.<span style="color: #202020;">bounds</span> <span style="color: #339933;">=</span> CGRectMake<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">320</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">450</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Une hauteur de -30 pixels par rapport à la normal. </span>
 <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.oni-ecchi.info/blog/iphone/iphone-uiview.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Créer des applications Iphone</title>
		<link>http://www.oni-ecchi.info/blog/iphone/creer-des-applications-iphone.html</link>
		<comments>http://www.oni-ecchi.info/blog/iphone/creer-des-applications-iphone.html#comments</comments>
		<pubDate>Tue, 16 Sep 2008 12:01:41 +0000</pubDate>
		<dc:creator>Guillaume chave</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[débutant]]></category>
		<category><![CDATA[découverte]]></category>
		<category><![CDATA[tutoriel]]></category>

		<guid isPermaLink="false">http://www.oni-ecchi.info/blog/?p=65</guid>
		<description><![CDATA[Mise à jour 29/07/09 : Cet article date d&#8217;un peu .. sa version raccourci et plus clair est disponible sur ! Have Fun :p Cet article a pour but de vous expliquer comment créer une application Iphone. Afin d’éviter un abus de langage, nous différencions deux types d’applications potentiels : •    Les applications web : [...]]]></description>
			<content:encoded><![CDATA[<p><cite class="aligncenter"><strong>Mise à jour 29/07/09 : </strong>Cet article date d&#8217;un peu .. sa version raccourci et plus clair est disponible sur <a class="shal" href=" http://www.oni-ecchi.info/blog/iphone/debuter-sur-le-developpement-iphone.html" title=" Débuter sur le développement iPhone">Débuter sur le développement iPhone</a> ! Have Fun :p </cite></p>
<p>Cet article a pour but de vous expliquer comment créer une application <a href="http://www.oni-ecchi.info/blog/tag/iphone" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec iPhone">Iphone</a>.<br />
Afin d’éviter un abus de langage, nous différencions deux types d’applications potentiels :</p>
<p>•    Les applications web : ouvert via Safari et qui ne sont ni plus ni moins un site dédié au format de l’iphone.<br />
•    Les applications embarqués : Application directement téléchargé sur le iphone store (gratuitement ou pas) pour lequel l’utilisateur doit donner son mot de passe pour l’installer.</p>
<p>Cet article traitera principalement du 2e type d’application.</p>
<p><span id="more-65"></span></p>
<h3>Application Web</h3>
<p>Afin de créer une application web iphone, la règle constatée est d’avoir un look Apple et celui suffit.<br />
Pour ce faire il peut être intéressant d’utiliser :</p>
<p>•    iUI – pour User Interface (UI) Library for Safari development on iPhone qui est disponible sur http://code.google.com/p/iui/<br />
Cela fournit des images, un CSS et une bibliothèque Javascript permettant de simuler une <a href="http://www.oni-ecchi.info/blog/tag/navigation" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec navigation">navigation</a> sur une application Iphone « embarqué ». Deux exemples sont disponibles :</p>
<ul>
<li><a href="http://iui.googlecode.com/svn/tags/REL-current/samples/music.html#_home">http://iui.googlecode.com/svn/tags/REL-current/samples/music.html#_home</a></li>
<li><a href="http://iui.googlecode.com/svn/tags/REL-current/samples/digg/index.html">http://iui.googlecode.com/svn/tags/REL-current/samples/digg/index.html</a></li>
</ul>
<p>•    Un tutorial expliquant comment créer le css, et le javascript pour profiter, détecter et se servir de la « rotation » de l’iphone</p>
<ul>
<li><a href="http://nettuts.com/misc/learn-how-to-develop-for-the-iphone/">http://nettuts.com/misc/learn-how-to-develop-for-the-iphone/</a></li>
</ul>
<p>•    Un plugin Firefox pour « émuler » l’affichage dans un iphone</p>
<ul>
<li><a href="http://blogs.sun.com/scblog/entry/iphone_emulator_for_firefox">http://blogs.sun.com/scblog/entry/iphone_emulator_for_firefox</a></li>
</ul>
<p>•    Une application AIR pour emuler l’iphone sur PC. Attention ce n’est qu’une beta.</p>
<ul>
<li><a href="http://merhl.com/?page_id=75">http://merhl.com/?page_id=75</a></li>
</ul>
<p>•    Un site web pour tester les applications web est disponible : http://www.testiphone.com/</p>
<p>Ces pistes de réflexions devraient vous aider à concevoir un site spécial iphone.</p>
<p>Rappel : The vertical view dimensions are 320&#215;365 pixels while the horizontal view dimensions are 480&#215;200 pixels.<br />
Note : De nombreux sites proposent une version iphone et parlent de leur « application iphone », d’où l’existence d’un certain abus de langage sur le terme « application »</p>
<h3>Application embarqué</h3>
<p>La création d’application pour Iphone permet ainsi d’avoir une application « hors ligne ». Idéal pour les jeux commerciaux, les utilitaires etc.</p>
<p>Le kit de développement (SDK) est fourni gracieusement par Apple, nous pouvons donc développé des applications qui fonctionneront dans l’émulateur fourni.</p>
<p>Cependant il faut payer une licence pour pouvoir mettre son application sur un vrai téléphone et être disponible sur l’apple store.<br />
•    99$ pour un particulier.<br />
•    300$ pour une entreprise.</p>
<p>Le fait d’avoir cette licence nous donne accès à « l’Iphone Developer Program » (<a href="http://developer.apple.com/iphone/program/">http://developer.apple.com/iphone/program/</a>).  Un résumé des étapes pour faire partie du programme est disponible sur <a href="http://forum.frenchiphone.com/index.php/topic,18561.0.html">http://forum.frenchiphone.com/index.php/topic,18561.0.html</a>.</p>
<p>Une fois sur l’apple store notre application est hébergé directement chez Apple, ils ont à leurs charges les coût d’hébergements, fournissent une plateforme de téléchargement etc.</p>
<p>Lors de la « mise en ligne » de notre application nous pouvons la distribuer :<br />
•    Gratuitement. Apple prend en charge la totalité des coûts.<br />
•    Commercialement. 70% du prix de l’application nous revient et apple prend les 30% restant pour frais d’entretiens.</p>
<h3>Contraintes de fonctionnements :</h3>
<p>Pour développer grâce à leur SDK nous devons avoir un mac OS X (version 10.5.3 ou supérieur).</p>
<p>Et notre application ne fonctionnera que sur les iphone possédant le firmware 2.1. Celui-ci est sorti le 13 septembre 2008.</p>
<p>Le simulateur intégré au SDK ne permet pas de :<br />
•    Simuler l’accéléromètre<br />
•    D’utiliser l’appareil photo de l’iphone. Au passage, nous ne pouvons enregistré de vidéo via l’appareil photo.<br />
•    D’accéder à certaines librairies des frameworks (souvent lorsqu’on récupère du code « iphone », il ne peut être porté directement dans le SDK vu que certains utilisent une version non officiel du SDK d’Apple où nativement il a plus de librairies).</p>
<p>Une contrainte d’Apple est que chaque application « vie » dans un bureau cloisonné. Nous ne pouvons accéder aux ressources d’autres applications (comme les mp3 et vidéo stocker sur le téléphone).</p>
<p>Plus d’information sur : <a href="http://www.gizmodo.fr/2008/08/05/lindispensable-marche-noir-des-applications-pour-iphone.html">http://www.gizmodo.fr/2008/08/05/lindispensable-marche-noir-des-applications-pour-iphone.html</a></p>
<h3>Programmer sur Iphone :</h3>
<p>L’API de l’iphone est quasiment la même que pour développer sous mac.<br />
Il faut utiliser « Cocoa »(L’iphone a sa version de Cocoa nommé « Cocoa Touch »). <a href="http://fr.wikipedia.org/wiki/Cocoa_(Apple)">http://fr.wikipedia.org/wiki/Cocoa_(Apple)</a> .</p>
<p><cite class="aligncenter">Cocoa est l&#8217;API native d&#8217;Apple pour le développement orienté objet sur son système d&#8217;exploitation Mac OS X. C&#8217;est l&#8217;une des 5 API majeur disponible pour Mac OS X,</cite></p>
<p>Pour utiliser cette API sur l’Iphone, nous sommes contraint d’utiliser les environnements de développements suivants<br />
•    Xcode (anciennement Project Builder) : compile et lance l’émulateur de l’iphone.<br />
•    Interface Builder : Permet d’agir graphiquement sur les vues et permet un développement rapide de l’application d’un point de vue graphique.</p>
<p>Le langage de programmation utilisé est Objective-C.</p>
<p><cite class="aligncenter">Wikipédia : L&#8217;Objective-C est un langage de programmation orienté objet réflexif. C&#8217;est une extension du C ANSI comme le C++ mais se distingue de ce dernier par sa distribution dynamique des messages, son typage dynamique et son chargement dynamique. Contrairement au C++, il ne permet pas l&#8217;héritage multiple mais il existe toutefois des moyens de combiner les avantages de C++ et d&#8217;Objective-C.</cite></p>
<h3>Ressources</h3>
<p>Voici une liste de ressources disponibles pour</p>
<p>•    Apprendre à utiliser Cocoa et Objective-C</p>
<p>o    Un cours pour <a href="http://www.oni-ecchi.info/blog/tag/debutant" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec débutant">débutant</a> est disponible dans le thread de ce forum.</p>
<ul>
<li><a href="http://www.objective-cocoa.org/forum/index.php?topic=2107">http://www.objective-cocoa.org/forum/index.php?topic=2107</a> (Cliquez sur 2.X en gras du sujet pour télécharger le cours)</li>
</ul>
<p>o    Débuter avec Cocoa en utilisant Objective-C</p>
<ul>
<li><a href="http://www.cocoalab.com/?q=becomeanxcoder">http://www.cocoalab.com/?q=becomeanxcoder</a></li>
</ul>
<p>o    Un cours est disponible sur le site du zéro pour Objective-C :</p>
<ul>
<li><a href="http://www.siteduzero.com/tutoriel-3-5208-la-programmation-mac.html#part_5209">http://www.siteduzero.com/tutoriel-3-5208-la-programmation-mac.html#part_5209</a></li>
</ul>
<p>o    Un livre « biblique » selon les développeurs Mac peut être acheter pour 36.10€</p>
<ul>
<li><a href="http://www.amazon.fr/Cocoa-par-pratique-Aaron-Hillegass/dp/2212112327">http://www.amazon.fr/Cocoa-par-pratique-Aaron-Hillegass/dp/2212112327</a></li>
</ul>
<p>L’objective-C a une notation et une utilisation de la programmation objet quelque peu déroutante si l’on vient du monde « Java, PHP5, C# ». Le cours du site du zéro est très précis pour comprendre la syntaxe et la notation.</p>
<p>•    Tutoriaux pour crée des applications iphone</p>
<p>o    Un pdf, des exemples, et des templates de code sont disponibles dans cet article</p>
<ul>
<li><a href="http://www.iphoneatlas.com/2007/09/19/the-unofficial-iphone-sdk-guide-to-writing-native-iphone-applications">http://www.iphoneatlas.com/2007/09/19/the-unofficial-iphone-sdk-guide-to-writing-native-iphone-applications</a>/</li>
</ul>
<p>o    Tutorial pour la création d’interface « dynamique »</p>
<ul>
<li><a href="http://mikael-morvan.developpez.com/tutoriels/iphone/sdk/rad">http://mikael-morvan.developpez.com/tutoriels/iphone/sdk/rad</a></li>
</ul>
<p>o    Tutorial pour créer un lecteur RSS pour Iphone :</p>
<ul>
<li><a href="http://theappleblog.com/2008/08/04/tutorial-build-a-simple-rss-reader-for-iphone/">http://theappleblog.com/2008/08/04/tutorial-build-a-simple-rss-reader-for-iphone/</a></li>
</ul>
<p>o    Utiliser les évènements, les contrôleurs et les vues</p>
<ul>
<li><a href="    *  http://www.iphonesdkarticles.com/2008/07/first-iphone-application.html "> http://www.iphonesdkarticles.com/2008/07/first-iphone-application.html</a></li>
</ul>
<p>o    Des Tutoriaux Vidéos sont disponibles sur</p>
<ul>
<li><a href="http://www.wonderhowto.com/how-to/video/how-to-program-a-uitableview-in-an-iphone-with-xcode-196230/">http://www.wonderhowto.com/how-to/video/how-to-program-a-uitableview-in-an-iphone-with-xcode-196230/</a> La qualité est médiocre</li>
</ul>
<ul>
<li><a href="http://developer.apple.com/iphone/index.action">http://developer.apple.com/iphone/index.action</a> -  le site d’Apple (une fois authentifié)</li>
</ul>
<p>o    Avoir le look and feel d’apple</p>
<ul>
<li><a href="http://www.teehanlax.com/blog/?p=447">http://www.teehanlax.com/blog/?p=447</a></li>
</ul>
<p>o    Forum d’entre-aide</p>
<ul>
<li><a href="http://www.iphonefr.com/viewforum.php?id=48">http://www.iphonefr.com/viewforum.php?id=48</a></li>
</ul>
<ul>
<li><a href="http://forum.frenchiphone.com/index.php/board,94.0.html">http://forum.frenchiphone.com/index.php/board,94.0.html</a></li>
</ul>
<p><cite class="aligncenter">Sans oublier tous mes liens concernant l&#8217;iphone : <a href="http://delicious.com/onishinji/iphone">http://delicious.com/onishinji/iphone</a></cite></p>
]]></content:encoded>
			<wfw:commentRss>http://www.oni-ecchi.info/blog/iphone/creer-des-applications-iphone.html/feed</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>Qu&#8217;est ce qu&#8217;il faut pour commencer sur Android ?</title>
		<link>http://www.oni-ecchi.info/blog/android/quest-ce-quil-faut-pour-commencer-sur-android.html</link>
		<comments>http://www.oni-ecchi.info/blog/android/quest-ce-quil-faut-pour-commencer-sur-android.html#comments</comments>
		<pubDate>Tue, 02 Sep 2008 19:54:52 +0000</pubDate>
		<dc:creator>Guillaume chave</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[débutant]]></category>
		<category><![CDATA[tutoriel]]></category>

		<guid isPermaLink="false">http://www.oni-ecchi.info/blog/?p=30</guid>
		<description><![CDATA[Petit rappel sur Android (mais est ce bien la peine ?) : Android est un système d&#8217;exploitation pour téléphone portable. Crée par google et open-source il ouvre une voie vers les téléphones mobiles enfin personnalisables à souhait pour les geek que nous sommes :) Bon, pour en savoir vraiment quelque chose, rien ne vaut un [...]]]></description>
			<content:encoded><![CDATA[<p>Petit rappel sur <a href="http://www.oni-ecchi.info/blog/tag/android" class="st_tag internal_tag" rel="tag" title="Voir les articles classés avec Android">Android</a> (mais est ce bien la peine ?) :</p>
<blockquote><p>Android est un système d&#8217;exploitation pour téléphone portable.</p>
<p>Crée par google et open-source il ouvre une voie vers les téléphones mobiles enfin personnalisables à souhait pour les geek que nous sommes :)</p></blockquote>
<p>Bon, pour en savoir vraiment quelque chose, rien ne vaut <a href="http://fr.wikipedia.org/wiki/Android" target="_blank">un petit wikipedia</a>. Pour l&#8217;instant aucun téléphone ne l&#8217;embarque mais c&#8217;est en cours d&#8217;arrivé ( Cf<a href="http://fr.techcrunch.com/2008/08/19/cela-se-confirme-le-premier-telephone-google-android-se-rapproche/" target="_blank"> Techcrunch</a> &amp; cf <a href="http://fr.techcrunch.com/2008/08/26/fr-cest-officiel-le-g1-t-mobilehtc-est-le-premier-telephone-portable-android/" target="_blank">Techcrund</a>). Enfin là n&#8217;est pas mon discours.</p>
<p>Je me dit juste qu&#8217;après avoir vu cette vidéo prise sur Techcrunch (ouais je l&#8217;aime ce site ^^) vous voudriez peut être avoir les bases pour commencer.</p>
<h3>Mise en bouche</h3>
<div id="blip_movie_content_1191469" style="width: 480px; height: 412px;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="412" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="id" value="video_player_object" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="wmode" value="window" /><param name="quality" value="best" /><param name="src" value="http://blip.tv/scripts/flash/showplayer.swf?file=http%3A//blip.tv/rss/flash/1191469%3Fsource%3D3&amp;enablejs=true&amp;showplayerpath=http%3A//blip.tv/scripts/flash/showplayer.swf&amp;autostart=false&amp;smallPlayerMode=true&amp;playerUrl=http%3A//blip.tv/scripts/flash/showplayer.swf" /><embed id="video_player_object" type="application/x-shockwave-flash" width="480" height="412" src="http://blip.tv/scripts/flash/showplayer.swf?file=http%3A//blip.tv/rss/flash/1191469%3Fsource%3D3&amp;enablejs=true&amp;showplayerpath=http%3A//blip.tv/scripts/flash/showplayer.swf&amp;autostart=false&amp;smallPlayerMode=true&amp;playerUrl=http%3A//blip.tv/scripts/flash/showplayer.swf" quality="best" wmode="window" allowscriptaccess="always" allowfullscreen="true"></embed></object></div>
<p><a href="http://blip.tv/scripts/flash/showplayer.swf?file=http%3A//blip.tv/rss/flash/1191469%3Fsource%3D3&amp;enablejs=true&amp;showplayerpath=http%3A//blip.tv/scripts/flash/showplayer.swf&amp;autostart=false&amp;smallPlayerMode=true&amp;playerUrl=http%3A//blip.tv/scripts/flash/showplayer.swf">Présentation d&#8217;android &#8211; via Techcrunch</a></p>
<h3>Les bonnes adresses</h3>
<p>Pour commencer à développer sur Android voici trois liens à conserver précieusement :</p>
<ol>
<li><a href="http://code.google.com/android/documentation.html" target="_blank">Le site officiel</a>, logique. Même si je trouve les tutoriels un peu long à lire et pénible, ça reste la référence :)</li>
<li><a href="http://andbook.anddev.org/" target="_blank">L&#8217;ebook de Nicolas Gramlich </a>pour commencer ses premières applications. J&#8217;en suis tombé amoureux ^^ c&#8217;est court mais précis. Parfait pour quelqu&#8217;un ayant des bases en développement, c&#8217;est le condensé le plus agréable à lire.</li>
<li><a href="http://www.anddev.org/">Le forum Anddev</a> : Rempli de tutoriaux et d&#8217;aides, c&#8217;est idéal pour s&#8217;instruire. En plus y a plein d&#8217;images dans les tutoriaux, wahouu :)<a href="http://www.anddev.org/"><br />
</a></li>
</ol>
<p>Vous remarquerez que tous ces liens sont en anglais. Et oui, en langue française y a bien quelques blogs/sites qui parlent de l&#8217;actualité d&#8217;Android, mais rien de bien sérieux pour les développeurs. Sans doute cela doit exister, mais je ne les ai jamais trouvé jusqu&#8217;à présent ..</p>
<p>J&#8217;allai oublier un lien, francais cette fois, bien utile pour commencer <a href="http://java.developpez.com/cours/" target="_blank">http://java.developpez.com/cours/</a> Et ouais, Android c&#8217;est du java traficoté ^^</p>
<h3>Logiciels et SDK</h3>
<p>Pas de miracle, on fait du Java, on est open-source et on va télécharger Eclipse et son plugin Android ^^</p>
<p><a href="http://code.google.com/android/intro/installing.html">http://code.google.com/android/intro/installing.html</a></p>
<p>Et on tente de comprendre l&#8217;anglais ^^</p>
<h3>Et ensuite ?</h3>
<p>Bientôt des traductions de tutoriels existants (es ce bien utile ?), et des petites découvertes de code sur Android (j&#8217;espère en trouver ^^)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.oni-ecchi.info/blog/android/quest-ce-quil-faut-pour-commencer-sur-android.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

