<?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>ComSubVie's Creative Content &#187; Computer</title>
	<atom:link href="http://markus.ocrs.at/category/computer/feed/" rel="self" type="application/rss+xml" />
	<link>http://markus.ocrs.at</link>
	<description>a blog about computer science, rc-modeling, movies and other things...</description>
	<lastBuildDate>Thu, 18 Jun 2009 13:56:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>iPhone OS 3.0 GM &#8211; Tethering Profil für Orange</title>
		<link>http://markus.ocrs.at/2009/06/11/iphone-os-30-gm-tethering/</link>
		<comments>http://markus.ocrs.at/2009/06/11/iphone-os-30-gm-tethering/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 21:59:30 +0000</pubDate>
		<dc:creator>ComSubVie</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Orange]]></category>
		<category><![CDATA[Tethering]]></category>

		<guid isPermaLink="false">http://markus.ocrs.at/?p=751</guid>
		<description><![CDATA[Update 2: Auf iPhone-notes.de &#124; mobileconfig können Tethering-Profile automatisch für eine Vielzahl von Providern abgerufen werden (die Liste wirkt ziemlich vollständig).
Update 1: Funktioniert auch mit der Final Release 3.0 (7A341) &#8211; da diese ohnehin identisch mit der GM ist.
Nachdem ich es letztendlich dann doch nicht mehr erwarten konnte und einen Developer Account besitze, habe ich [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update 2: Auf <a href="http://www.iphone-notes.de/mobileconfig/">iPhone-notes.de | mobileconfig</a> können Tethering-Profile automatisch für eine Vielzahl von Providern abgerufen werden (die Liste wirkt ziemlich vollständig).</strong></p>
<p><strong>Update 1: Funktioniert auch mit der Final Release 3.0 (7A341) &#8211; da diese ohnehin identisch mit der GM ist.</strong></p>
<p>Nachdem ich es letztendlich dann doch nicht mehr erwarten konnte und einen Developer Account besitze, habe ich mir das iPhone OS 3.0 GM heruntergeladen und auch gleich installiert. Erster Eindruck: funktioniert problemlos, macht einen weitaus flotteren Eindruck als das OS 2.x und synchronisiert die Notizen wirklich. Das beste &#8220;Feature&#8221; (eigentlich ist das ja mehr ein Bugfix) ist meiner Meinung nach, das iCal jetzt auch die Farben der Kalender mitsynchronisiert &#8211; das war ja schon lange überfällig.</p>
<p>Nachdem dies also alles zur vollsten Zufriedenheit funktioniert hat, wollte ich Tethering aktivieren, allerdings kam da immer die Fehlermeldung ich möge mich doch an meinen Betreiber wenden (&#8221;Um Tethering für diesen Account zu aktivieren, wenden Sie sich an Orange Austria&#8221;). Kurzes Nachfragen bei Orange lieferte die Antwort das das OS 3.0 ja noch gar nicht da ist, das es aber dann ein entsprechendes Zusatzpaket für Tethering geben wird (etwa 2€/Monat), sie aber im Moment nichts genaues wissen.</p>
<p>Na gut. Muss aber auch so gehen. Also entsprechend im Internet herumgesucht und fündig geworden: <a href="http://iszene.com/thread-48319.html">iszene.com: iPhone OS 3 GM &#8211; Tethering einschalten (Mac only)</a> &#8211; also gleich das Configuration Utility (erneut) heruntergeladen (das ist mir offenbar irgendwann mal verloren gegangen), ein Profil erstellt, dieses modifiziert und per Mail ans iPhone gesendet. iPhone neu gestartet und TATA &#8211; weder iTunes noch iPhoto noch sonstwer hat das Handy erkannt. Das Problem allerdings ist, dass das iPhone Configuration Utility scheinbar nicht mit dem aktuellen SDK kompatibel ist (siehe <a href="http://getsatisfaction.com/apple/topics/iphone_no_longer_recognised_by_mac_after_running_iphone_configuration_utility">iPhone no longer recognised by Mac after running iPhone Configuration Utility</a>). Also das iPhone SDK 3.0 GM neu installiert und siehe da, kaum steckt man das iPhone an, wird es im iTunes, im iPhoto und in den Netzwerkeinstellungen (als ethernet) erkannt. Tethering funktioniert damit problemlos sowohl über GPRS als auch über 3G (nachdem man Tethering in den Einstellungen (Allgemein-Netzwerk) aktiviert hat.</p>
<p><strong>Damit ihr euch den Umweg über das Configuration Utility sparen könnt gibt es hier das entsprechende Profil für Orange Austria. Einfach herunterladen, per Mail ans iPhone schicken und dort installieren (theoretisch müsste es auch direkt aus dem Mobile Safari raus gehen): </strong><a href="http://markus.ocrs.at/wp-content/uploads/2009/06/tethering.mobileconfig"><strong>iPhone Tethering Profil für Orange Austria</strong></a></p>
<p>Für andere Provider sind endsprechend andere Einstellungen mit dem Configuration Utility für die APN, Benutzername und Passwort notwendig, ein paar davon finden sich hier: <a href="http://www.iphone-notes.de/?p=5696">iPhone-notes.de | iPhone OS 3.0 MMS / Tethering Settings</a>. Viel Erfolg!</p>
]]></content:encoded>
			<wfw:commentRss>http://markus.ocrs.at/2009/06/11/iphone-os-30-gm-tethering/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Myst fürs iPhone</title>
		<link>http://markus.ocrs.at/2009/05/04/myst-furs-iphone/</link>
		<comments>http://markus.ocrs.at/2009/05/04/myst-furs-iphone/#comments</comments>
		<pubDate>Mon, 04 May 2009 14:07:21 +0000</pubDate>
		<dc:creator>ComSubVie</dc:creator>
				<category><![CDATA[AppStore]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Spiele]]></category>

		<guid isPermaLink="false">http://markus.ocrs.at/?p=647</guid>
		<description><![CDATA[Das nächste erwähnenswerte Spiel ist eine Umsetzung von Myst für das iPhone: Myst (iTMS).
Soweit man das mit dem Trailer erkennen kann scheint es ganz nett zu sein, der Download von 727MB ist recht umfangreich, sobald ich mich näher damit beschäftigt habe (und der Download abgeschlossen ist) werde ich hier entsprechende Kommentare verfassen.

]]></description>
			<content:encoded><![CDATA[<p>Das nächste erwähnenswerte Spiel ist eine Umsetzung von Myst für das iPhone: <a href="http://clk.tradedoubler.com/click?p=24380&amp;a=1606960&amp;url=http%3A%2F%2Fitunes.apple.com%2FWebObjects%2FMZStore.woa%2Fwa%2FviewSoftware%3Fid%3D311941991%26mt%3D8%26uo%3D6%26partnerId%3D2003">Myst (iTMS)</a>.</p>
<p>Soweit man das mit dem Trailer erkennen kann scheint es ganz nett zu sein, der Download von 727MB ist recht umfangreich, sobald ich mich näher damit beschäftigt habe (und der Download abgeschlossen ist) werde ich hier entsprechende Kommentare verfassen.</p>
<p style="text-align: center;"><!-- Smart Youtube --><span class="youtube"><object width="480" height="360"><param name="movie" value="http://www.youtube.com/v/XTFyj-L4mrs&amp;rel=1&amp;color1=d6d6d6&amp;color2=f0f0f0&amp;border=&amp;fs=1&amp;hl=en&amp;autoplay=&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0&amp;ap=%2526fmt%3D18" /><param name="allowFullScreen" value="true" /><embed wmode="transparent" src="http://www.youtube.com/v/XTFyj-L4mrs&amp;rel=1&amp;color1=d6d6d6&amp;color2=f0f0f0&amp;border=&amp;fs=1&amp;hl=en&amp;autoplay=&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0&amp;ap=%2526fmt%3D18" type="application/x-shockwave-flash" allowfullscreen="true" width="480" height="360" ></embed><param name="wmode" value="transparent" /></object></span></p>
]]></content:encoded>
			<wfw:commentRss>http://markus.ocrs.at/2009/05/04/myst-furs-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Car Jack Streets</title>
		<link>http://markus.ocrs.at/2009/04/29/car-jack-streets/</link>
		<comments>http://markus.ocrs.at/2009/04/29/car-jack-streets/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 13:34:04 +0000</pubDate>
		<dc:creator>ComSubVie</dc:creator>
				<category><![CDATA[AppStore]]></category>
		<category><![CDATA[Spiele]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://markus.ocrs.at/?p=637</guid>
		<description><![CDATA[Das nächste Spiel das ich mir aus eher neuzeitlichen Oldie-Ambitionen zugelegt habe ist Car Jack Streets, ein GTA (1) Klon für das iPhone. Das Spiel ist nicht nur grafisch sehr ähnlich zu GTA 1, sondern wurde auch von den gleichen Leuten (zumindest zum Teil) entwickelt.
Auch hier gibt es wieder ein Video von Touch Arcade:

Und von [...]]]></description>
			<content:encoded><![CDATA[<p>Das nächste Spiel das ich mir aus eher neuzeitlichen Oldie-Ambitionen zugelegt habe ist <a href="http://clk.tradedoubler.com/click?p=24380&amp;a=1606960&amp;url=http%3A%2F%2Fitunes.apple.com%2FWebObjects%2FMZStore.woa%2Fwa%2FviewSoftware%3Fid%3D306712767%26mt%3D8%26uo%3D6%26partnerId%3D2003">Car Jack Streets</a>, ein GTA (1) Klon für das iPhone. Das Spiel ist nicht nur grafisch sehr ähnlich zu GTA 1, sondern wurde auch von den gleichen Leuten (zumindest zum Teil) entwickelt.</p>
<p>Auch hier gibt es wieder ein Video von Touch Arcade:</p>
<p style="text-align: center;"><!-- Smart Youtube --><span class="youtube"><object width="480" height="360"><param name="movie" value="http://www.youtube.com/v/js_DRIHe8jo&amp;rel=1&amp;color1=d6d6d6&amp;color2=f0f0f0&amp;border=&amp;fs=1&amp;hl=en&amp;autoplay=&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0&amp;ap=%2526fmt%3D18" /><param name="allowFullScreen" value="true" /><embed wmode="transparent" src="http://www.youtube.com/v/js_DRIHe8jo&amp;rel=1&amp;color1=d6d6d6&amp;color2=f0f0f0&amp;border=&amp;fs=1&amp;hl=en&amp;autoplay=&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0&amp;ap=%2526fmt%3D18" type="application/x-shockwave-flash" allowfullscreen="true" width="480" height="360" ></embed><param name="wmode" value="transparent" /></object></span></p>
<p>Und von Tag Games eine Serie an YouTube Videos über die Entwicklung des Spiels: <a href="http://www.youtube.com/watch?v=YC2I46cG-2c&#038;fmt=18">Meet the Team</a>, <a href="http://www.youtube.com/watch?v=EErXS0QNGrk&#038;fmt=18">Origins</a>, <a href=http://www.youtube.com/watch?v=irc4rzFv8nc">Art</a> und <a href="http://www.youtube.com/watch?v=gdACYXzGQWc&#038;fmt=18">Code</a>.</p>
<p>Ich finde es ist eine gelungene Umsetzung des Klassikers auf das iPhone zu einem durchaus auch vernünftigen Preis (von etwa 2-3 Kaffees), sodass nicht sonderlich viel verloren ist. Wem das Original gefallen hat, der kann unbesorgt zu dieser iPhone Umsetzung greifen.</p>
]]></content:encoded>
			<wfw:commentRss>http://markus.ocrs.at/2009/04/29/car-jack-streets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Assassin&#8217;s Creed: Altaïr&#8217;s Chronicles</title>
		<link>http://markus.ocrs.at/2009/04/29/assassins-creed/</link>
		<comments>http://markus.ocrs.at/2009/04/29/assassins-creed/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 11:12:39 +0000</pubDate>
		<dc:creator>ComSubVie</dc:creator>
				<category><![CDATA[AppStore]]></category>
		<category><![CDATA[Spiele]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://markus.ocrs.at/?p=632</guid>
		<description><![CDATA[Nachdem ich mir vor längerer Zeit Assassin&#8217;s Creed für den PC zugelegt habe -- und so gut wie nicht gespielt habe, da mir die Zeit (ge)fehlt (hat) -- und mir das Spielprinzip und die Umsetzung durchaus zugesagt hat, habe ich beschlossen mir ebenso den Ableger für das iPhone zu kaufen: Assassin&#8217;s Creed -- Altaïr&#8217;s Chronicles
Die [...]]]></description>
			<content:encoded><![CDATA[<p>Nachdem ich mir vor längerer Zeit Assassin&#8217;s Creed für den PC zugelegt habe -- und so gut wie nicht gespielt habe, da mir die Zeit (ge)fehlt (hat) -- und mir das Spielprinzip und die Umsetzung durchaus zugesagt hat, habe ich beschlossen mir ebenso den Ableger für das iPhone zu kaufen: <a href="http://clk.tradedoubler.com/click?p=24380&amp;a=1606960&amp;url=http%3A%2F%2Fitunes.apple.com%2FWebObjects%2FMZStore.woa%2Fwa%2FviewSoftware%3Fid%3D313367811%26mt%3D8%26uo%3D6%26partnerId%3D2003">Assassin&#8217;s Creed -- Altaïr&#8217;s Chronicles</a></p>
<p>Die Umsetzung auf das iPhone ist durchwegs gelungen, die Grafik ist ziemlich brauchbar und auch die Bedienung ist ganz in Ordnung. Anfangs muss man sich ein bisschen an das &#8220;Steuerkreuz&#8221; gewöhnen (auf der linken Bildschirmseite ist ein Steuerkreuz eingeblendet, welches touchsensitiv die Figur steuert), hier dürfte der gleiche Effekt wie bei der iPhone-Tastatur vorhanden sein, dass der physikalische Berührungspunkt nicht unbedingt auch der gedachte Berührungspunkt ist, sodass man immer ein paar Millimeter daneben ist.</p>
<p>Von der Bedienung her spielt sich Assassin&#8217;s Creed ähnlich wie ein altes Jump&#8217;n'Run mit ein paar eher nebensächlichen Diebstahls- und Verhörseinlagen.</p>
<p>Für das iPhone ist es ein eher teureres Spiel (so um die 8€), aber in Anbetracht der Spielqualität, der Umsetzung und des Umfangs ein durchaus vernünftiger Preis. Aufgrund des größeren Umfangs (&gt;100MB) existieren immer wieder längere Ladezeiten zwischen den Levels, auch dauert der Start des Spiels ein bisschen. Diese Wartezeiten sind nicht wirklich störend, jedoch verhindern diese ein kurzes Spiel zwischen 2 U-Bahn-Stationen.</p>
<p>Dennoch finde ich das Spiel sehr gelungen mit einem fairen Preis/Leistungsverhältnis, das ich durchaus weiterempfehlen kann.</p>
<p>Hier noch ein kurzes Gameplay-Video von Touch Arcade:</p>
<p style="text-align: center;"><!-- Smart Youtube --><span class="youtube"><object width="480" height="360"><param name="movie" value="http://www.youtube.com/v/dkZ39563sew&amp;rel=1&amp;color1=d6d6d6&amp;color2=f0f0f0&amp;border=&amp;fs=1&amp;hl=en&amp;autoplay=&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0&amp;ap=%2526fmt%3D18" /><param name="allowFullScreen" value="true" /><embed wmode="transparent" src="http://www.youtube.com/v/dkZ39563sew&amp;rel=1&amp;color1=d6d6d6&amp;color2=f0f0f0&amp;border=&amp;fs=1&amp;hl=en&amp;autoplay=&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0&amp;ap=%2526fmt%3D18" type="application/x-shockwave-flash" allowfullscreen="true" width="480" height="360" ></embed><param name="wmode" value="transparent" /></object></span></p>
]]></content:encoded>
			<wfw:commentRss>http://markus.ocrs.at/2009/04/29/assassins-creed/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>iPhone OS / SDK 3.0</title>
		<link>http://markus.ocrs.at/2009/03/18/iphone-os-sdk-30/</link>
		<comments>http://markus.ocrs.at/2009/03/18/iphone-os-sdk-30/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 14:55:19 +0000</pubDate>
		<dc:creator>ComSubVie</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[iPhone SDK]]></category>
		<category><![CDATA[Programmieren]]></category>

		<guid isPermaLink="false">http://markus.ocrs.at/?p=576</guid>
		<description><![CDATA[Nachdem gestern ja das neue iPhone OS vorgestellt wurde, habe ich mir dieses gleich einmal näher angeschaut (allerdings werde ich es nicht so schnell installieren, da die meisten der neuen Features für meine Applikationen jetzt nicht wirklich wesentlich von Bedeutung sind &#8211; ich hab zwar schon ein paar Ideen, aber das reicht glaub ich wenn [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://markus.ocrs.at/wp-content/uploads/2009/03/iphone-3-new-1jpg.jpeg" rel="lightbox[576]"><img class="aligncenter size-medium wp-image-577" title="iphone-3-new-1jpg" src="http://markus.ocrs.at/wp-content/uploads/2009/03/iphone-3-new-1jpg-300x233.jpg" alt="iphone-3-new-1jpg" width="300" height="233" /></a>Nachdem gestern ja das neue iPhone OS vorgestellt wurde, habe ich mir dieses gleich einmal näher angeschaut (allerdings werde ich es nicht so schnell installieren, da die meisten der neuen Features für meine Applikationen jetzt nicht wirklich wesentlich von Bedeutung sind &#8211; ich hab zwar schon ein paar Ideen, aber das reicht glaub ich wenn ich das implementiere wenn alles andere schon fertig ist).</p>
<p>Bei der Übersicht der neuen Features wären mir die folgenden Dinge aufgefallen:</p>
<ul>
<li>Bluetooth Kommunikation zwischen den Geräten</li>
<li>Zugriff auf über das Dock angeschlossene Hardware (ich hab die dazugehörige ExternalAccessory API aber noch nicht wirklich durchblickt)</li>
<li>CoreData (ich werd das zwar nicht so schnell verwenden, aber prinzipiell ist das ganz nett, und könnte möglicherweise das Synchen zwischen iPhone- und Desktop-Applikationen erleichtern bzw. auf einfache Weise auf beiden Seiten die gleichen Datenrepräsentation ermöglichen)</li>
<li>CoreLocation erlaut Turn-by-Turn Anweisungen (allerdings nicht in Google Maps, aber ich vermute dass damit TomTom &amp; Co demnächst im AppStore verfügbar sein wird)</li>
<li>Push notifications (ich glaub zwar nicht das ich die so schnell brauchen werde, aber auf dieser Basis dürfte demnächst eine Meebo-Applikation erscheinen)</li>
<li>Notes Sync (ich verwende zwar mittlerweile Things, aber das ist trotzdem schon lange überfällig)</li>
</ul>
<p>Eine detaillierte Liste an API Änderungen ist (für Developer) auch verfügbar &#8211; die ist wirklich recht lang. Die interessantesten sind dabei:</p>
<ul>
<li>CoreFoundation: NSPredicate wurde hinzugefügt. Letztens habe ich mich über dessen Fehlen geärgert, weil das Filtern von UITableViews mit NSPredicate einfacher wäre als ohne. Ein entsprechendes Beispiel wird es früher oder später hier im UITableView Tutorial geben (sobald ich dieses erstellt habe).</li>
<li>GameKit ist meiner Meinung nach ein bisschen komisch benannt, weil das nicht nur für Spiele interessant ist:<br />
<blockquote><p>The GKPeerPickerController class provides a standard user interface to allow a user to connect their iPhone to another user’s iPhone. The user can select between local Bluetooth connections and internet connections.</p></blockquote>
</li>
<li>MapKit erlaubt es Google Maps in eigene Applikationen einzubauen.</li>
<li>UIKit hat einige interessante Erweiterungen erfahren: einige Navigationselemente lassen sich nun leicht transparent schalten.
<ul>
<li>UITableView: <tt>reloadRowsAtIndexPaths:withRowAnimation:</tt>, <tt>reloadSectionIndexTitles</tt>, <tt>reloadSections:withRowAnimation:</tt> erlauben es bei Anpassungen an der DataSource nur die relevanten Abschnitte neu zu laden, sodass nicht mehr die ganze UITableView neu geladen werden muss.</li>
<li>UITableViewCell: hier sind einige der bisher vorhandenen (und zu verwendenden) Properties inzwischen deprecated (so ist statt .text inzwischen .textLabel und .detailTextLabel zu verwenden)</li>
</ul>
</li>
</ul>
<p>Ansonsten sind mir jetzt für Developer keine wesentlichen Änderungen aufgefallen (zumindest nicht in Bereichen mit denen ich mich inzwischen beschäftigt habe).</p>
<p>Ich bin mir zwar nicht ganz sicher, inwieweit man das überhaupt veröffentlichen darf, da auf der Developer-Seite steht:</p>
<blockquote><p>iPhone SDK 3.0 and iPhone OS 3.0 beta are pre-release software and are considered Apple Confidential Information. Any information Apple collects is subject to the terms of the Apple privacy policy.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://markus.ocrs.at/2009/03/18/iphone-os-sdk-30/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nav Bar Tutorial (Version 2)</title>
		<link>http://markus.ocrs.at/2009/03/13/nav-bar-tutorial-version-2/</link>
		<comments>http://markus.ocrs.at/2009/03/13/nav-bar-tutorial-version-2/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 20:56:22 +0000</pubDate>
		<dc:creator>ComSubVie</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[iPhone SDK]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://markus.ocrs.at/?p=565</guid>
		<description><![CDATA[Das zweite überarbeitete Tutorial beschäftigt sich mit der NavigationBar. Dabei handelt es sich um die Navigationsleiste am oberen Bildschirmrand, mit der man beispielsweise von Detailansichten wieder zur Übersicht zurückkommt, oder beim Bearbeiten von Einträgen die beiden Buttons &#8220;Save&#8221; und &#8220;Cancel&#8221; anzeigt.
Die UINavigationBar verwendet dabei eine Art Stack auf dem UIViewController Objekte abgelegt werden. Bei der [...]]]></description>
			<content:encoded><![CDATA[<p>Das zweite überarbeitete Tutorial beschäftigt sich mit der <em>NavigationBar</em>. Dabei handelt es sich um die Navigationsleiste am oberen Bildschirmrand, mit der man beispielsweise von Detailansichten wieder zur Übersicht zurückkommt, oder beim Bearbeiten von Einträgen die beiden Buttons &#8220;Save&#8221; und &#8220;Cancel&#8221; anzeigt.</p>
<p>Die <tt>UINavigationBar</tt> verwendet dabei eine Art Stack auf dem <tt>UIViewController</tt> Objekte abgelegt werden. Bei der Initialisierung muss in jedem Fall ein <strong>root</strong> ViewController angegeben werden. Dies ist jene View, die am Anfang angezeigt wird.</p>
<p>Mit den Methoden <tt>pushViewController:animated:</tt> sowie <tt>popViewControllerAnimated:</tt> lassen sich zusätzliche <tt>UIViewController</tt> im <tt>UINavigationController</tt> einbinden, wobei die Methode <tt>pushViewController:animated:</tt> den als Parameter angegebenen <tt>UIViewController</tt> anzeigt. Zusätzlich wird automatisch ein <em>Back</em>-Button auf der linken Seite der NavigationBar erzeugt, welcher den Titel des vorigen ViewControllers anzeigt. Die Methode <tt>popViewControllerAnimated:</tt> entfernt den aktuellen ViewController wieder und schaltet auf die vorige Sicht zurück.</p>
<p>Eine View, die in einen <tt>UINavigationController</tt> eingebunden ist, besitzt die Property <tt>navigationItem</tt>, über welche sich die angezeigte <tt>UINavigationBar</tt> modifizieren lässt. So enthält die <tt>UINavigationItem</tt> Klasse die Properties <tt>backBarButtonItem</tt>, <tt>leftBarButtonItem</tt>, <tt>rightBarButtonItem</tt> sowie <tt>title</tt>. Über diese Properties lassen sich die entsprechenden Buttons bzw. der Titel der in der Navigationbar angezeigt wird modifizieren.</p>
<p>Genug der Theorie. Um das Ganze zu demonstrieren möchte ich eine Applikation erstellen, die drei Views enthält, zwischen denen man mit der NavigationBar umschalten kann. Die erste View soll nur einen Add und Details-Button anzeigen, über die zur zweiten View umgeschaltet werden kann. Auf der zweiten View soll es einen Zurück-Button geben, der wieder auf die erste View zurückschaltet sowie einen Edit-Button der auf die dritte View umschaltet. Die dritte View soll die beiden Buttons Cancel (zurück zur zweiten View) und Save (ebenfalls zurück zur zweiten View) enthalten.</p>
<p>Wie immer beginne ich mit einem neuen Projekt vom Typ iPhone OS <strong>Window-Based Application</strong>, welche ich <tt>NavBar</tt> nenne. Dementsprechend erstellt XCode eine Hauptklasse <tt>NavBarAppDelegate.m</tt>.</p>
<p>Zusätzlich erstelle ich die drei Klassen für die drei Views. Diese sind ebenfalls wieder vom Typ <strong>UIViewController subclass</strong>, wobei ich diese wieder <tt>First</tt>, <tt>Second</tt> und <tt>Third</tt> taufe.</p>
<p>Die erste View (<tt>First.m</tt>) soll den Titel <em>First</em> in der NavigationBar anzeigen (Zeile 9) und zusätzlich auf der rechten Seite einen Add-Button (Zeile 10). Zusätzlich wird ein Button in der View angezeigt, der den Titel <em>Details</em> trägt (Zeilen 12-21). Beide Buttons werden mit der Methode <tt>buttonPressed</tt> verbunden (Zeile 10 und 17). Die Methode <tt>buttonPressed</tt> initialisiert die nächste View (also Second, Zeile 25) und zeigt diese über den ViewController an (Zeile 27).</p>
<p><tt>First.m</tt>:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#import &quot;First.h&quot;</span><br />
<span style="color: #6e371a;">#import &quot;Second.h&quot;</span><br />
<br />
<span style="color: #a61390;">@implementation</span> First<br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>loadView <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>super loadView<span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; self.navigationItem.title <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;First&quot;</span>;<br />
&nbsp; &nbsp; self.navigationItem.rightBarButtonItem <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIBarButtonItem alloc<span style="color: #002200;">&#93;</span> initWithBarButtonSystemItem<span style="color: #002200;">:</span>UIBarButtonSystemItemAdd target<span style="color: #002200;">:</span>self action<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>buttonPressed<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; UIView <span style="color: #002200;">*</span>tempView <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIView alloc<span style="color: #002200;">&#93;</span> initWithFrame<span style="color: #002200;">:</span>CGRectMake<span style="color: #002200;">&#40;</span>0.0, 0.0, 320.0, 480.0<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; UIButton <span style="color: #002200;">*</span>button <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>;<br />
&nbsp; &nbsp; button.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span>10.0, 10.0, 300.0, 50.0<span style="color: #002200;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>button setTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Details&quot;</span> forState<span style="color: #002200;">:</span>UIControlStateNormal<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>button addTarget<span style="color: #002200;">:</span>self action<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>buttonPressed<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span> forControlEvents<span style="color: #002200;">:</span>UIControlEventTouchUpInside<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>tempView addSubview<span style="color: #002200;">:</span>button<span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>self setView<span style="color: #002200;">:</span>tempView<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>tempView release<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>buttonPressed<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>sender <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; Second <span style="color: #002200;">*</span>second <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>Second alloc<span style="color: #002200;">&#93;</span> initWithNibName<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> bundle<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>self.navigationController pushViewController<span style="color: #002200;">:</span>second animated<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #a61390;">@end</span></div></td></tr></tbody></table></div>
<p>Die zweite View enthält durch das laden automatisch einen Back-Button auf der rechten Seite der NavigationBar. Zusätzlich muss ein Edit-Button auf der rechten Seite hinzugefügt werden (Zeile 10) und der Titel auf <em>Second</em> gesetzt werden (Zeile 9). Wenn der Back-Button gedrückt wird, schaltet der NavigationController automatisch auf die vorige View zurück. Bei Benutzung des Edit-Buttons (Zeile 8 ) muss äquivalent zur vorigen View eine neue Instanz der nächsten View erzeugt und auf diese umgeschaltet werden (Zeilen 14-16).</p>
<p><tt>Second.m</tt>:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#import &quot;Second.h&quot;</span><br />
<span style="color: #6e371a;">#import &quot;Third.h&quot;</span><br />
<br />
<span style="color: #a61390;">@implementation</span> Second<br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>loadView <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>super loadView<span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; self.navigationItem.title <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Second&quot;</span>;<br />
&nbsp; &nbsp; self.navigationItem.rightBarButtonItem <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIBarButtonItem alloc<span style="color: #002200;">&#93;</span> initWithBarButtonSystemItem<span style="color: #002200;">:</span>UIBarButtonSystemItemEdit target<span style="color: #002200;">:</span>self action<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>buttonPressed<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>buttonPressed<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>sender <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; Third <span style="color: #002200;">*</span>third <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>Third alloc<span style="color: #002200;">&#93;</span> initWithNibName<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> bundle<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>self.navigationController pushViewController<span style="color: #002200;">:</span>third animated<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #a61390;">@end</span></div></td></tr></tbody></table></div>
<p>Die letzte View besitzt den Titel <em>Third</em> (Zeile 8 ) sowie zwei Buttons in der Navigationbar (Cancel, Zeile 9 sowie Save, Zeile 10). Beide Buttons lösen einen Rücksprung zur vorigen View aus (Zeile 14):</p>
<p><tt>Third.m</tt>:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#import &quot;Third.h&quot;</span><br />
<br />
<span style="color: #a61390;">@implementation</span> Third<br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>loadView <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>super loadView<span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; self.navigationItem.title <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Third&quot;</span>;<br />
&nbsp; &nbsp; self.navigationItem.leftBarButtonItem &nbsp;<span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIBarButtonItem alloc<span style="color: #002200;">&#93;</span> initWithBarButtonSystemItem<span style="color: #002200;">:</span>UIBarButtonSystemItemCancel target<span style="color: #002200;">:</span>self action<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>buttonPressed<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; self.navigationItem.rightBarButtonItem <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIBarButtonItem alloc<span style="color: #002200;">&#93;</span> initWithBarButtonSystemItem<span style="color: #002200;">:</span>UIBarButtonSystemItemSave &nbsp; target<span style="color: #002200;">:</span>self action<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>buttonPressed<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>buttonPressed<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>sender <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>self.navigationController popViewControllerAnimated<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #a61390;">@end</span></div></td></tr></tbody></table></div>
<p>Im Hauptprogramm (<tt>NavBarAppDelegate</tt>) muss nun eine Instanz der ersten View (der Root View) erstellt werden (Zeile 11) und ein <tt>UINavigationController</tt> mit dieser initialisiert werden (Zeile 12). Anschließend wird der Navigation Controller als View der Applikation aktiviert (Zeile 14).</p>
<p><tt>NavBarAppDelegate.m</tt>:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#import &quot;NavBarAppDelegate.h&quot;</span><br />
<span style="color: #6e371a;">#import &quot;First.h&quot;</span><br />
<br />
<span style="color: #a61390;">@implementation</span> NavBarAppDelegate<br />
<br />
<span style="color: #a61390;">@synthesize</span> window;<br />
<br />
UINavigationController <span style="color: #002200;">*</span>navController;<br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>applicationDidFinishLaunching<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIApplication <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>application <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; First <span style="color: #002200;">*</span>firstView <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>First alloc<span style="color: #002200;">&#93;</span> initWithNibName<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> bundle<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; navController <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UINavigationController alloc<span style="color: #002200;">&#93;</span> initWithRootViewController<span style="color: #002200;">:</span>firstView<span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>window addSubview<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>navController view<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>window makeKeyAndVisible<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>dealloc <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>window release<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>navController release<span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>super dealloc<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #a61390;">@end</span></div></td></tr></tbody></table></div>
<p>Auch hier erspare ich es mir das ganze Projekt als Source hochzuladen, da auch dieses noch recht trivial ist. Die nächsten geplanten Tutorials sind: Kombination <tt>UITabBar</tt> mit <tt>UINavigationBar</tt>, <tt>UITableView</tt> sowie Delegation. Sowie eventuell etwas über Cocoa-Memorymanagement. Mal schauen&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://markus.ocrs.at/2009/03/13/nav-bar-tutorial-version-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tab Bar Tutorial (Version 2)</title>
		<link>http://markus.ocrs.at/2009/03/11/tab-bar-tutorial-version-2/</link>
		<comments>http://markus.ocrs.at/2009/03/11/tab-bar-tutorial-version-2/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 22:26:52 +0000</pubDate>
		<dc:creator>ComSubVie</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[iPhone SDK]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://markus.ocrs.at/?p=561</guid>
		<description><![CDATA[Nachdem ich ja bereits geschrieben habe, dass ich inzwischen vom Interface Builder abgekommen bin (zumindest Großteils; um eine View zu entwerfen und die Daten dann im Code zu übernehmen ist der IB durchaus ganz brauchbar) beginne ich mal mit der ersten Anleitung ohne den IB.
Wie bereits zuvor beginne ich mit einer TabBar Applikation. Dabei soll [...]]]></description>
			<content:encoded><![CDATA[<p>Nachdem ich ja bereits geschrieben habe, dass ich inzwischen vom <em>Interface Builder</em> abgekommen bin (zumindest Großteils; um eine View zu entwerfen und die Daten dann im Code zu übernehmen ist der IB durchaus ganz brauchbar) beginne ich mal mit der ersten Anleitung ohne den IB.</p>
<p>Wie bereits zuvor beginne ich mit einer TabBar Applikation. Dabei soll einfach eine Applikation entstehen, die 2 verschiedene Views enthält, zwischen denen man mit Hilfe einer TabBar umschalten kann. Das grundsätzliche Vorgehen bei der Projekterstellung bleibt dabei gleich, d.h. zuerst wird ein neues Projekt vom Typ iPhone OS <strong>Window-Based Application</strong> erstellt. Da ich die Applikation <tt>TabBar</tt> genannt habe, erzeugt XCode eine Hauptklasse <tt>TabBarAppDelegate.m</tt>.</p>
<p>Zusätzlich dazu erstelle ich zwei weitere Klassen, für jede View eine eigene Klasse, die vom Typ <strong>UIViewController subclass</strong> sind, und die ich sinnvollerweise <tt>First.m</tt> sowie <tt>Second.m</tt> nenne. In jeder dieser beiden Views erstelle ich in der Methode <tt>loadView</tt> ein Label, welches den Text &#8220;First View&#8221; bzw. &#8220;Second View&#8221; anzeigen soll. Diese beiden Klassen sind eigentlich selbsterklärend und sehen wie folgt aus (die Header-Dateien <tt>First.h</tt> und <tt>Second.h</tt> habe ich dabei nicht modifiziert):</p>
<p><tt>First.m</tt>:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#import &quot;First.h&quot;</span><br />
<br />
<span style="color: #a61390;">@implementation</span> First<br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>loadView <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>super loadView<span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; UILabel <span style="color: #002200;">*</span>label <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>0.0, 0.0, 320.0, 480.0<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; label.textAlignment <span style="color: #002200;">=</span> UITextAlignmentCenter;<br />
&nbsp; &nbsp; label.text <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;First View&quot;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>self setView<span style="color: #002200;">:</span>label<span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>label release<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #a61390;">@end</span></div></td></tr></tbody></table></div>
<p><tt>Second.m</tt>:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#import &quot;Second.h&quot;</span><br />
<br />
<span style="color: #a61390;">@implementation</span> Second<br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>loadView <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>super loadView<span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; UILabel <span style="color: #002200;">*</span>label <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>0.0, 0.0, 320.0, 480.0<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; label.textAlignment <span style="color: #002200;">=</span> UITextAlignmentCenter;<br />
&nbsp; &nbsp; label.text <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Second View&quot;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>self setView<span style="color: #002200;">:</span>label<span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>label release<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #a61390;">@end</span></div></td></tr></tbody></table></div>
<p>Im Hauptprogramm, d.h. in der <tt>TabBarAppDelegate</tt> erstelle ich von jedem der beiden ViewController <tt>First</tt> und <tt>Second</tt> eine neue Instanz (Zeile 13 und 14). Ein ViewController besitzt die Property tabBarItem, bei der man den Titel angeben kann (.title), der auf dem zugehörigen Tab dargestellt werden soll, sowie auch ein dazugehöriges Icon (.image). Die beiden Tabs werden hier ebenfalls mit &#8220;First&#8221; und &#8220;Second&#8221; tituliert (Zeile 16 und 17). Anschließend wird ein neuer <tt>UITabBarController</tt> erstellt (Zeile 19) sowie mitgeteilt welche Views (bzw. Tabs) er darstellen soll (Zeile 20). Letztendlich wird dem aktuellen <tt>Window</tt> der Applikation der <tt>UITabBarController</tt> als Subview gesetzt (Zeile 22).</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#import &quot;TabBarAppDelegate.h&quot;</span><br />
<br />
<span style="color: #6e371a;">#import &quot;First.h&quot;</span><br />
<span style="color: #6e371a;">#import &quot;Second.h&quot;</span><br />
<br />
<span style="color: #a61390;">@implementation</span> TabBarAppDelegate<br />
<br />
<span style="color: #a61390;">@synthesize</span> window;<br />
<br />
UITabBarController <span style="color: #002200;">*</span>tabBarController;<br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>applicationDidFinishLaunching<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIApplication <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>application <span style="color: #002200;">&#123;</span> &nbsp;<br />
&nbsp; &nbsp; First &nbsp;<span style="color: #002200;">*</span>firstViewController &nbsp;<span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>First &nbsp;alloc<span style="color: #002200;">&#93;</span> initWithNibName<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> bundle<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; Second <span style="color: #002200;">*</span>secondViewController <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>Second alloc<span style="color: #002200;">&#93;</span> initWithNibName<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> bundle<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; firstViewController.tabBarItem.title &nbsp;<span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;First&quot;</span>;<br />
&nbsp; &nbsp; secondViewController.tabBarItem.title <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Second&quot;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; tabBarController <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UITabBarController alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; tabBarController.viewControllers <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSArray</span> arrayWithObjects<span style="color: #002200;">:</span>firstViewController, secondViewController, <span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>window addSubview<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>tabBarController view<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>firstViewController &nbsp;release<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>secondViewController release<span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>window makeKeyAndVisible<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>dealloc <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>tabBarController release<span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>window release<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>super dealloc<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #a61390;">@end</span></div></td></tr></tbody></table></div>
<p>Und das war schon die ganze Hexerei. Irgendwie weitaus einfacher und schneller als mit dem Interface Builder, und außerdem weiß man so in etwa was dabei passiert. Da das ganze so trivial ist halte ich es nicht für notwendig ein Archiv des Projektes zum Download zur Verfügung zu stellen, ich kann es bei Bedarf aber durchaus gerne weitergeben.</p>
]]></content:encoded>
			<wfw:commentRss>http://markus.ocrs.at/2009/03/11/tab-bar-tutorial-version-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slow Blogging Days</title>
		<link>http://markus.ocrs.at/2009/03/05/slow-blogging-days/</link>
		<comments>http://markus.ocrs.at/2009/03/05/slow-blogging-days/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 08:40:58 +0000</pubDate>
		<dc:creator>ComSubVie</dc:creator>
				<category><![CDATA[Dieses Blog]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[CreativeContent]]></category>

		<guid isPermaLink="false">http://markus.ocrs.at/?p=559</guid>
		<description><![CDATA[Ich hab gerade auf Rebel Science News gelesen:
I am intensely involved in a programming project and I am finding it hard to change my focus to other matters. As a result, my blogging activities will be less frequent. Please bear with me.
Das kann ich nur unterschreiben. Aber mein Programm macht durchaus Fortschritte. Außerdem sollte ich [...]]]></description>
			<content:encoded><![CDATA[<p>Ich hab gerade auf <a href="http://rebelscience.blogspot.com/">Rebel Science News</a> gelesen:</p>
<blockquote><p>I am intensely involved in a programming project and I am finding it hard to change my focus to other matters. As a result, my blogging activities will be less frequent. Please bear with me.</p></blockquote>
<p>Das kann ich nur unterschreiben. Aber mein Programm macht durchaus Fortschritte. Außerdem sollte ich jetzt demnächst neue iPhone-HowTo&#8217;s (ohne Interface Builder) posten, aber im Moment bin ich eher mim programmieren beschäftigt (und Diplomarbeit sollt ich wohl auch irgendwann mal machen).</p>
]]></content:encoded>
			<wfw:commentRss>http://markus.ocrs.at/2009/03/05/slow-blogging-days/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone Development: Current Status</title>
		<link>http://markus.ocrs.at/2009/03/01/iphone-development-current-status/</link>
		<comments>http://markus.ocrs.at/2009/03/01/iphone-development-current-status/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 22:18:14 +0000</pubDate>
		<dc:creator>ComSubVie</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[iPhone SDK]]></category>
		<category><![CDATA[Programmieren]]></category>

		<guid isPermaLink="false">http://markus.ocrs.at/?p=553</guid>
		<description><![CDATA[Nachdem ich ja letztens 2 kurze Tutorials geschrieben habe, bin ich dann irgendwann draufgekommen, das das ganze dann doch nicht so einfach ist. Da ich ja nach wie vor damit beschäftigt bin, meine FlightLog-Applikation zu schreiben, musste ich feststellen, dass das mit dem Interface Builder irgendwie nicht immer so hinhaut wie man es erwarten sollte. [...]]]></description>
			<content:encoded><![CDATA[<p>Nachdem ich ja letztens 2 kurze Tutorials geschrieben habe, bin ich dann irgendwann draufgekommen, das das ganze dann doch nicht so einfach ist. Da ich ja nach wie vor damit beschäftigt bin, meine FlightLog-Applikation zu schreiben, musste ich feststellen, dass das mit dem Interface Builder irgendwie nicht immer so hinhaut wie man es erwarten sollte. Daher verwende ich diesen nur noch in seltenen Fällen.</p>
<p>Demzufolge wird es demnächst auch ein neues HowTo geben, wie man Tab Bar + Navigation Bar + TableView + SQLite verwendet, um was-auch-immer zu machen. Allerdings wird dies wohl noch ein Zeiterl dauern&#8230; (und irgendwie sollte ich nebenbei auch noch schauen, das meine Diplomarbeit fertig wird).</p>
<p>Hier dennoch 2 Screenshots vom aktuellen Status meiner Applikation (die Daten kommen bereits aus einer SQLite Datenbank):</p>

<a href='http://markus.ocrs.at/2009/03/01/iphone-development-current-status/bild-2-2/' title='bild-2'><img width="150" height="150" src="http://markus.ocrs.at/wp-content/uploads/2009/03/bild-2-150x150.png" class="attachment-thumbnail" alt="" title="bild-2" /></a>
<a href='http://markus.ocrs.at/2009/03/01/iphone-development-current-status/bild-3-2/' title='bild-3'><img width="150" height="150" src="http://markus.ocrs.at/wp-content/uploads/2009/03/bild-3-150x150.png" class="attachment-thumbnail" alt="" title="bild-3" /></a>

]]></content:encoded>
			<wfw:commentRss>http://markus.ocrs.at/2009/03/01/iphone-development-current-status/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone Development: Nav Bar Mini HowTo</title>
		<link>http://markus.ocrs.at/2009/02/28/iphone-development-nav-bar-mini-howto/</link>
		<comments>http://markus.ocrs.at/2009/02/28/iphone-development-nav-bar-mini-howto/#comments</comments>
		<pubDate>Sat, 28 Feb 2009 12:49:27 +0000</pubDate>
		<dc:creator>ComSubVie</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[iPhone SDK]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://markus.ocrs.at/?p=531</guid>
		<description><![CDATA[Nachdem sich das letzte Mini HowTo it dem &#8220;Root&#8221;-Navigationselement, der Tab Bar beschäftigt hat, will ich hier die Verwendung der Navigation Bar zeigen. Wenn keine Tab Bar verwendet wird, dann kann die Navigation Bar das &#8220;höchste&#8221; Navigationselement der Anwendung sein, ansonsten muss es in ein View der Tab Bar eingebaut werden.
Beispiele für die Navigation Bar [...]]]></description>
			<content:encoded><![CDATA[<p>Nachdem sich das letzte Mini HowTo it dem &#8220;Root&#8221;-Navigationselement, der Tab Bar beschäftigt hat, will ich hier die Verwendung der Navigation Bar zeigen. Wenn keine Tab Bar verwendet wird, dann kann die Navigation Bar das &#8220;höchste&#8221; Navigationselement der Anwendung sein, ansonsten muss es in ein View der Tab Bar eingebaut werden.</p>
<p>Beispiele für die Navigation Bar finden sich in vielen Applikationen, so wird dies zum Beispiel bei den Kontakten verwendet, um einen neuen Kontakt anzulegen, oder um von einem Kontakt wieder auf die Kontaktliste zurückzukommen.</p>
<p>Wie bereits zuvor erwähnt verwende ich für sämtliche Applikationen die Window-Based Application als Vorlage. Äquivalent zur Anwendung der Tab Bar wird die Datei MainWindow.xib im Interface Builder geöffnet und ein Navigation Controller in das Fenster gezogen. Das Resultat sollte dann wie folgt aussehen:</p>
<p style="text-align: center;"><a href="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-1.png" rel="lightbox[531]"><img class="alignnone size-thumbnail wp-image-532" title="tutorialnavigationbar-bild-1" src="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-1-150x150.png" alt="tutorialnavigationbar-bild-1" width="150" height="150" /></a> <a href="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-2.png" rel="lightbox[531]"><img class="alignnone size-thumbnail wp-image-533" title="tutorialnavigationbar-bild-2" src="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-2-150x150.png" alt="tutorialnavigationbar-bild-2" width="150" height="150" /></a></p>
<p>Anschließend wird dieser Controller im AppDelegate in XCode wieder als IBOutlet hinzugefügt:</p>
<p><tt>TutorialNavigationBarAppDelegate.h</tt>:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#import &lt;UIKit/UIKit.h&gt;</span><br />
<br />
<span style="color: #a61390;">@interface</span> TutorialNavigationBarAppDelegate <span style="color: #002200;">:</span> <span style="color: #400080;">NSObject</span> &lt;UIApplicationDelegate&gt; <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; UIWindow&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">*</span>window;<br />
&nbsp; &nbsp; UINavigationController&nbsp; <span style="color: #002200;">*</span>navController; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// LINE ADDED</span><br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> IBOutlet UIWindow <span style="color: #002200;">*</span>window;<br />
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> IBOutlet UINavigationController &nbsp; <span style="color: #002200;">*</span>navController; <span style="color: #11740a; font-style: italic;">// LINE ADDED</span><br />
<br />
<span style="color: #a61390;">@end</span></div></td></tr></tbody></table></div>
<p><tt>TutorialNavigationBarAppDelegate.m</tt>:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#import &quot;TutorialNavigationBarAppDelegate.h&quot;</span><br />
<br />
<span style="color: #a61390;">@implementation</span> TutorialNavigationBarAppDelegate<br />
<br />
<span style="color: #a61390;">@synthesize</span> window;<br />
<span style="color: #a61390;">@synthesize</span> navController;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// LINE ADDED</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>applicationDidFinishLaunching<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIApplication <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>application <span style="color: #002200;">&#123;</span> &nbsp; &nbsp;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>window addSubview<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>navController view<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// LINE ADDED</span><br />
<br />
&nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// Override point for customization after application launch</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>window makeKeyAndVisible<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>dealloc <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>window release<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>super dealloc<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #a61390;">@end</span></div></td></tr></tbody></table></div>
<p>Im Anschluss werden die Outlets im Interface Builder verbunden, d.h. der Navigation Controller wird rechts angeklickt und der Kreis des &#8220;New Referencing Outlet&#8221; auf das Tutorial Navigation Bar App Delegate gezogen. Das Resultat sollte dann wie folgt aussehen:</p>
<p><a href="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-3.png" rel="lightbox[531]"><img class="aligncenter size-thumbnail wp-image-534" title="tutorialnavigationbar-bild-3" src="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-3-150x150.png" alt="tutorialnavigationbar-bild-3" width="150" height="150" /></a></p>
<p>Die Applikation sollte jetzt bereits laufen und eine leere View mit einer Navigation Bar anzeigen:</p>
<p><a href="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-4.png" rel="lightbox[531]"><img class="aligncenter size-thumbnail wp-image-535" title="tutorialnavigationbar-bild-4" src="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-4-150x150.png" alt="tutorialnavigationbar-bild-4" width="150" height="150" /></a></p>
<p>Um die Navigation Bar vernünftig verwenden zu können, wird einerseits ein Eingabe-Element benötigt, mit dem auf eine andere View umgeschaltet werden kann, andererseits auch noch diese View, auf die umgeschaltet werden soll.</p>
<p>Im XCode erstelle ich daher eine neue Datei vom Typ &#8220;User Interfaces&#8221; &#8220;View XIB&#8221;, die ich View2.xib taufe.</p>
<p style="text-align: center;"><a href="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-5.png" rel="lightbox[531]"><img class="alignnone size-thumbnail wp-image-536" title="tutorialnavigationbar-bild-5" src="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-5-150x150.png" alt="tutorialnavigationbar-bild-5" width="150" height="150" /></a> <a href="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-6.png" rel="lightbox[531]"><img class="alignnone size-thumbnail wp-image-537" title="tutorialnavigationbar-bild-6" src="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-6-150x150.png" alt="tutorialnavigationbar-bild-6" width="150" height="150" /></a></p>
<p>Diese Datei wird nun mit dem Interface Builder geöffnet. Damit diese hier auch der richtigen Größe entspricht, kann man über &#8220;View Attributes&#8221; als Top Bar eine Navigation Bar simulieren.</p>
<p><a href="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-7.png" rel="lightbox[531]"><img class="aligncenter size-thumbnail wp-image-538" title="tutorialnavigationbar-bild-7" src="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-7-150x150.png" alt="tutorialnavigationbar-bild-7" width="150" height="150" /></a></p>
<p>Diese View bekommt ein Label, welches ich &#8220;displayText&#8221; taufe, damit man zumindest irgendetwas erkennen kann.</p>
<p style="text-align: center;"><a href="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-8.png" rel="lightbox[531]"><img class="alignnone size-thumbnail wp-image-539" title="tutorialnavigationbar-bild-8" src="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-8-150x150.png" alt="tutorialnavigationbar-bild-8" width="150" height="150" /></a> <a href="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-9.png" rel="lightbox[531]"><img class="alignnone size-thumbnail wp-image-540" title="tutorialnavigationbar-bild-9" src="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-9-150x150.png" alt="tutorialnavigationbar-bild-9" width="150" height="150" /></a></p>
<p>Weiters muss für diese View auch wieder ein View Controller erstellt werden. Dazu erstellt man im XCode eine neue Datei vom Typ &#8220;UIViewController subclass&#8221;, die ich View2ViewController taufe.</p>
<p style="text-align: center;"><a href="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-10.png" rel="lightbox[531]"><img class="alignnone size-thumbnail wp-image-541" title="tutorialnavigationbar-bild-10" src="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-10-150x150.png" alt="tutorialnavigationbar-bild-10" width="150" height="150" /></a> <a href="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-11.png" rel="lightbox[531]"><img class="alignnone size-thumbnail wp-image-542" title="tutorialnavigationbar-bild-11" src="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-11-150x150.png" alt="tutorialnavigationbar-bild-11" width="150" height="150" /></a></p>
<p>In diesen beiden Dateien erstelle ich ein IBOutlet für das Label, damit man den Text auch modifizieren kann. Die beiden Dateien sehen danach wie folgt aus:</p>
<p><tt>View2ViewController.h</tt>:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#import &lt;UIKit/UIKit.h&gt;</span><br />
<br />
<span style="color: #a61390;">@interface</span> View2ViewController <span style="color: #002200;">:</span> UIViewController <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; UILabel &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">*</span>displayText; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// LINE ADDED</span><br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> IBOutlet UILabel&nbsp; <span style="color: #002200;">*</span>displayText; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// LINE ADDED</span><br />
<br />
<span style="color: #a61390;">@end</span></div></td></tr></tbody></table></div>
<p><tt>View2ViewController.m</tt>:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#import &quot;View2ViewController.h&quot;</span><br />
<br />
<span style="color: #a61390;">@implementation</span> View2ViewController<br />
<br />
<span style="color: #a61390;">@synthesize</span> displayText;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// LINE ADDED</span><br />
<br />
<span style="color: #11740a; font-style: italic;">/*<br />
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.<br />
- (void)viewDidLoad {<br />
&nbsp; &nbsp; [super viewDidLoad];<br />
}<br />
*/</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>didReceiveMemoryWarning <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>super didReceiveMemoryWarning<span style="color: #002200;">&#93;</span>; <span style="color: #11740a; font-style: italic;">// Releases the view if it doesn't have a superview</span><br />
&nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// Release anything that's not essential, such as cached data</span><br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>dealloc <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>super dealloc<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #a61390;">@end</span></div></td></tr></tbody></table></div>
<p>View Controller und View müssen im Interface Builder wieder miteinander verbunden werden. Als Class für den &#8220;File&#8217;s Owner&#8221; verwendet man den eben erstellten View2ViewController:</p>
<p><a href="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-12.png" rel="lightbox[531]"><img class="aligncenter size-thumbnail wp-image-543" title="tutorialnavigationbar-bild-12" src="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-12-150x150.png" alt="tutorialnavigationbar-bild-12" width="150" height="150" /></a></p>
<p>Und das &#8220;New Referencing Outlet&#8221; des displayText Labels mit dem displayText Attribut des &#8220;File&#8217;s Owner&#8221;. Das Resultat sollte dann wie folgt aussehen:</p>
<p><a href="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-13.png" rel="lightbox[531]"><img class="aligncenter size-thumbnail wp-image-544" title="tutorialnavigationbar-bild-13" src="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-13-150x124.png" alt="tutorialnavigationbar-bild-13" width="150" height="124" /></a></p>
<p>Außerdem muss noch das View Attribut des &#8220;File&#8217;s Owner&#8221; mit der View verbunden werden. Dazu wird der &#8220;File&#8217;s Owner&#8221; rechts angeklickt, und der Kreis neben &#8220;view&#8221; auf die View gezogen. Das Ergebnis sollte so aussehen:</p>
<p><a href="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-14.png" rel="lightbox[531]"><img class="aligncenter size-thumbnail wp-image-545" title="tutorialnavigationbar-bild-14" src="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-14-150x150.png" alt="tutorialnavigationbar-bild-14" width="150" height="150" /></a></p>
<p>Die Umschaltung auf diese View muss nun irgendwie ausgelöst werden, daher füge ich in der MainWindow.xib einen Button hinzu (im Normalfall wird dies vermutlich eher aus einer TableView geschehen), den ich detailsButton taufe. Das sieht im Interface Builder dann wie folgt aus:</p>
<p><a href="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-15.png" rel="lightbox[531]"><img class="aligncenter size-thumbnail wp-image-546" title="tutorialnavigationbar-bild-15" src="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-15-150x150.png" alt="tutorialnavigationbar-bild-15" width="150" height="150" /></a></p>
<p>Wie man an diesem Bild erkennen kann, wird die View durch den Button ersetzt. Wenn man eine eigene View einsetzen will (was ich durchaus als sinnvoll erachte), so sollte man dem View Controller hier eine eigene XIB Datei angeben (allerdings bin ich mir nicht ganz sicher ob das funktioniert, weil es beim Tab Bar Controller ja nicht geklappt hat).</p>
<p>Anschließend füge ich die Outlets und die Action im AppDelegate ein (eine eigene View hätte hier den Vorteil, das die App Delegate nicht so überfüllt ist). Zustätzlich muss auch die neue View hier eingetragen werden. Die neuen App Delegate Dateien sehen dann so aus:</p>
<p><tt>TutorialNavBarAppDelegate.h</tt>:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#import &lt;UIKit/UIKit.h&gt;</span><br />
<br />
<span style="color: #6e371a;">#import &quot;View2ViewController.h&quot;</span><br />
<br />
<span style="color: #a61390;">@interface</span> TutorialNavigationBarAppDelegate <span style="color: #002200;">:</span> <span style="color: #400080;">NSObject</span> &lt;UIApplicationDelegate&gt; <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; UIWindow&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">*</span>window;<br />
&nbsp; &nbsp; UINavigationController&nbsp; <span style="color: #002200;">*</span>navController;<br />
<br />
&nbsp; &nbsp; UIButton&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">*</span>detailsButton; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// LINE ADDED</span><br />
<br />
&nbsp; &nbsp; View2ViewController &nbsp; &nbsp; <span style="color: #002200;">*</span>view2Controller; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// LINE ADDED</span><br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> IBOutlet UIWindow &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">*</span>window;<br />
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> IBOutlet UINavigationController &nbsp; <span style="color: #002200;">*</span>navController;<br />
<br />
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> IBOutlet UIButton &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">*</span>detailsButton; &nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// LINE ADDED</span><br />
<br />
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> View2ViewController &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">*</span>view2Controller; &nbsp; <span style="color: #11740a; font-style: italic;">// LINE ADDED</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>IBAction<span style="color: #002200;">&#41;</span> buttonPressed<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>sender;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// LINE ADDED</span><br />
<br />
<span style="color: #a61390;">@end</span></div></td></tr></tbody></table></div>
<p><tt>TutorialNavBarAppDelegate.m</tt>:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#import &quot;TutorialNavigationBarAppDelegate.h&quot;</span><br />
<br />
<span style="color: #a61390;">@implementation</span> TutorialNavigationBarAppDelegate<br />
<br />
<span style="color: #a61390;">@synthesize</span> window;<br />
<span style="color: #a61390;">@synthesize</span> navController;<br />
<span style="color: #a61390;">@synthesize</span> detailsButton;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// LINE ADDED</span><br />
<br />
<span style="color: #a61390;">@synthesize</span> view2Controller;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// LINE ADDED</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>IBAction<span style="color: #002200;">&#41;</span> buttonPressed<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>sender <span style="color: #002200;">&#123;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// BLOCK ADDED</span><br />
&nbsp; &nbsp; <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span> view2Controller <span style="color: #002200;">==</span> <span style="color: #a61390;">nil</span> <span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; view2Controller <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>View2ViewController alloc<span style="color: #002200;">&#93;</span> initWithNibName<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;View2&quot;</span> bundle<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>view2Controller displayText<span style="color: #002200;">&#93;</span>.text <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Details&quot;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>navController pushViewController<span style="color: #002200;">:</span>view2Controller animated<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>applicationDidFinishLaunching<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIApplication <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>application <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>window addSubview<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>navController view<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// Override point for customization after application launch</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>window makeKeyAndVisible<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>dealloc <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>window release<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>super dealloc<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #a61390;">@end</span></div></td></tr></tbody></table></div>
<p>Die buttonPressed Methode erzeugt eine neue View auf Basis des View2ViewControllers mit der View2 XIB als Resource, wobei der Text des Labels mit &#8220;Details&#8221; beschriftet wird. Anschließend wird der Navigation Controller aufgefordert, die View entsprechend umzuschalten.</p>
<p>Im Anschluss werden die ganzen Dinge wieder im Interface Builder verbunden, d.h. das &#8220;New Referencing Outlet&#8221; des detailsButton mit dem Tutorial Nav Bar App Delegate displayButton Attribut und das Touch Down Event des detailsButton mit der buttonPressed Methode des Tutorial Nav Bar App Delegates. Das Resultat ist hier dargestellt:</p>
<p><a href="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-16.png" rel="lightbox[531]"><img class="aligncenter size-thumbnail wp-image-547" title="tutorialnavigationbar-bild-16" src="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-16-150x150.png" alt="tutorialnavigationbar-bild-16" width="150" height="150" /></a></p>
<p>Das fertige Resultat sollte nun so aussehen:</p>
<p style="text-align: center;"><a href="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-17.png" rel="lightbox[531]"><img class="alignnone size-thumbnail wp-image-548" title="tutorialnavigationbar-bild-17" src="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-17-150x150.png" alt="tutorialnavigationbar-bild-17" width="150" height="150" /></a> <a href="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-18.png" rel="lightbox[531]"><img class="alignnone size-thumbnail wp-image-549" title="tutorialnavigationbar-bild-18" src="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar-bild-18-150x150.png" alt="tutorialnavigationbar-bild-18" width="150" height="150" /></a></p>
<p>Falls man einen Add Button einsetzen will, muss man dies in der viewDidLoad Methode des entsprechenden ViewControllers hinzufügen (bei diesem Beispiel funktioniert dies daher nur im View2ViewController, da die Startseite keine eigene View besitzt). Der folgende Code erledigt dies:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>IBAction<span style="color: #002200;">&#41;</span> addButtonPressed<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>sender <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// TODO Add Implementation</span><br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>viewDidLoad <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; self.navigationItem.rightBarButtonItem <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIBarButtonItem alloc<span style="color: #002200;">&#93;</span> initWithBarButtonSystemItem<span style="color: #002200;">:</span>UIBarButtonSystemItemAdd target<span style="color: #002200;">:</span>self action<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>addButtonPressed<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>super viewDidLoad<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span></div></td></tr></tbody></table></div>
<p>Hier ist nun wieder der komplette Code des Beispiels: <a href="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialnavigationbar.zip">TutorialNavBar (ZIP-Archiv)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://markus.ocrs.at/2009/02/28/iphone-development-nav-bar-mini-howto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone Development: Tab Bar Mini HowTo</title>
		<link>http://markus.ocrs.at/2009/02/27/iphone-development-tab-bar-mini-howto/</link>
		<comments>http://markus.ocrs.at/2009/02/27/iphone-development-tab-bar-mini-howto/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 22:25:44 +0000</pubDate>
		<dc:creator>ComSubVie</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[iPhone SDK]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://markus.ocrs.at/?p=513</guid>
		<description><![CDATA[Das Interface des iPhones ist in mehrere verschiedene Komponenten unterteilt. Die Tab Bar ist dabei jene Komponenten, die am unteren Rand des Displays angezeigt wird, und zwischen verschiedenen Darstellungen umschaltet.
Beim Telefon ist dies beispielswiese Favoriten, Anrufliste, Kontakte, Ziffernblock und Voicemail; bei der Uhr Weltuhr, Wecker, Stoppuhr sowie Timer.
Eine Tab Bar ist das &#8220;höchste&#8221; Navigationselement am [...]]]></description>
			<content:encoded><![CDATA[<p>Das Interface des iPhones ist in mehrere verschiedene Komponenten unterteilt. Die Tab Bar ist dabei jene Komponenten, die am unteren Rand des Displays angezeigt wird, und zwischen verschiedenen Darstellungen umschaltet.</p>
<p>Beim Telefon ist dies beispielswiese Favoriten, Anrufliste, Kontakte, Ziffernblock und Voicemail; bei der Uhr Weltuhr, Wecker, Stoppuhr sowie Timer.</p>
<p>Eine Tab Bar ist das &#8220;höchste&#8221; Navigationselement am iPhone. D.h. wenn eine Tab Bar verwendet werden soll, so sind alle anderen Ansichten dieser untergeordnet. Daher muss bei einer Applikation mit Tab Bar basierter Navigation diese Tab Bar als erstes Element implementiert werden.</p>
<p>Für sämtliche Applikationen am iPhone verwende ich die Window-Based Application als Vorlage. Diese generiert nur eine AppDelegate Klasse für die Anwendung sowie eine MainWindow.xib Datei, die das Interface definiert:</p>
<p style="text-align: center;"><a href="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-1-new-project-template.png" rel="lightbox[513]"><img class="alignnone size-thumbnail wp-image-514" title="bild-1-new-project-template" src="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-1-new-project-template-150x150.png" alt="bild-1-new-project-template" width="150" height="150" /></a> <a href="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-2-new-project-name.png" rel="lightbox[513]"><img class="alignnone size-thumbnail wp-image-515" title="bild-2-new-project-name" src="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-2-new-project-name-150x150.png" alt="bild-2-new-project-name" width="150" height="150" /></a> <a href="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-3-initial-project.png" rel="lightbox[513]"><img class="alignnone size-thumbnail wp-image-516" title="bild-3-initial-project" src="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-3-initial-project-150x150.png" alt="bild-3-initial-project" width="150" height="150" /></a></p>
<p>Um eine Tab Bar zu verwenden, wird zuerst die Datei MainWindow.xib im Interface Builder geöffnet und ein Tab Bar Controller in das Fenster gezogen. Das Resultat sieht wie folgt aus:</p>
<p style="text-align: center;"><a href="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-4-ib-mainwindow-xib.png" rel="lightbox[513]"><img class="alignnone size-thumbnail wp-image-517" title="bild-4-ib-mainwindow-xib" src="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-4-ib-mainwindow-xib-150x150.png" alt="bild-4-ib-mainwindow-xib" width="150" height="150" /></a> <a href="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-5-ib-tab-bar-controller.png" rel="lightbox[513]"><img class="alignnone size-thumbnail wp-image-518" title="bild-5-ib-tab-bar-controller" src="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-5-ib-tab-bar-controller-150x150.png" alt="bild-5-ib-tab-bar-controller" width="150" height="150" /></a></p>
<p>Anschließend wird im XCode der Controller als IBOutlet hinzugefügt, d.h. die Datei TutorialTabBarAppDelegate.h wie folgt geändert:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#import &lt;UIKit/UIKit.h&gt;</span><br />
<br />
<span style="color: #a61390;">@interface</span> TutorialTabBarAppDelegate <span style="color: #002200;">:</span> <span style="color: #400080;">NSObject</span> &lt;UIApplicationDelegate&gt; <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; UIWindow&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">*</span>window;<br />
&nbsp; &nbsp; UITabBarController&nbsp; <span style="color: #002200;">*</span>tabBarController;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// LINE ADDED</span><br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> IBOutlet UIWindow &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">*</span>window;<br />
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> IBOutlet UITabBarController &nbsp; <span style="color: #002200;">*</span>tabBarController;&nbsp; <span style="color: #11740a; font-style: italic;">// LINE ADDED</span><br />
<br />
<span style="color: #a61390;">@end</span></div></td></tr></tbody></table></div>
<p>Anschließend wird der Tab Bar Controller als View der Anwendung initialisiert, d.h. die Datei TutorialTabBarAppDelegate.m wie folgt modifiziert:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#import &quot;TutorialTabBarAppDelegate.h&quot;</span><br />
<br />
<span style="color: #a61390;">@implementation</span> TutorialTabBarAppDelegate<br />
<br />
<span style="color: #a61390;">@synthesize</span> window;<br />
<span style="color: #a61390;">@synthesize</span> tabBarController; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// LINE ADDED</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>applicationDidFinishLaunching<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIApplication <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>application <span style="color: #002200;">&#123;</span> &nbsp; &nbsp;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>window addSubview<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>tabBarController view<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// LINE ADDED</span><br />
<br />
&nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// Override point for customization after application launch</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>window makeKeyAndVisible<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>dealloc <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>window release<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>super dealloc<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #a61390;">@end</span></div></td></tr></tbody></table></div>
<p>Anschließend geht es wieder zurück zum Interface Builder. Hier wird der Tab Bar Controller rechts angeklickt. Daraufhin erscheint ein Popup-Fenster, in dem man den Kreis neben &#8220;New Referencing Outlet&#8221; auf das Tutorial Tab Bar App Delegate Objekt dragt, wo dann wieder ein Popup mit dem Inhalt &#8220;tabBarController&#8221; erscheint. Dieser tabBarController entspricht der IBOutlet-Variablen, die wir zuvor gerade angelegt haben. Das Resultat sollte wie folgt aussehen:</p>
<p><a href="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-6-ib-referencing-outlet.png" rel="lightbox[513]"><img class="aligncenter size-thumbnail wp-image-519" title="bild-6-ib-referencing-outlet" src="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-6-ib-referencing-outlet-150x150.png" alt="bild-6-ib-referencing-outlet" width="150" height="150" /></a></p>
<p>Die Applikation sollte jetzt bereits laufen und eine funktionierende Tab Bar darstellen:</p>
<p><a href="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-7-tutorial-tab-bar-v1.png" rel="lightbox[513]"><img class="aligncenter size-thumbnail wp-image-520" title="bild-7-tutorial-tab-bar-v1" src="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-7-tutorial-tab-bar-v1-150x150.png" alt="bild-7-tutorial-tab-bar-v1" width="150" height="150" /></a></p>
<p>Damit die ganze Anwendung überhaupt erst Sinn ergibt müssen für die einzelnen Tabs noch entsprechende Inhalte generiert werden. Dazu wird für jedes Tab eine eigene View angelegt.</p>
<p>Dazu wird im XCode eine neue Datei vom Typ UIViewController subclass angelegt, die den Namen &#8220;Tab1ViewController&#8221; erhält:</p>
<p style="text-align: center;"><a href="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-8-new-uiviewcontroller-template.png" rel="lightbox[513]"><img class="alignnone size-thumbnail wp-image-521" title="bild-8-new-uiviewcontroller-template" src="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-8-new-uiviewcontroller-template-150x150.png" alt="bild-8-new-uiviewcontroller-template" width="150" height="150" /></a> <a href="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-9-new-uiviewcontroller-name.png" rel="lightbox[513]"><img class="alignnone size-thumbnail wp-image-522" title="bild-9-new-uiviewcontroller-name" src="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-9-new-uiviewcontroller-name-150x150.png" alt="bild-9-new-uiviewcontroller-name" width="150" height="150" /></a></p>
<p>Die dadurch erstellten Dateien lasse ich vorerst unangetastet. Weiterhin wird eine Interface Builder Datei für diesen Controller erstellt, d.h. eine neue Datei vom Typ &#8220;View XIB&#8221; mit dem Namen &#8220;Tab1View&#8221; zum Projekt hinzugefügt:</p>
<p style="text-align: center;"><a href="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-10-new-uiview-xib-template.png" rel="lightbox[513]"><img class="alignnone size-thumbnail wp-image-523" title="bild-10-new-uiview-xib-template" src="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-10-new-uiview-xib-template-150x150.png" alt="bild-10-new-uiview-xib-template" width="150" height="150" /></a> <a href="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-11-new-uiview-xib-name.png" rel="lightbox[513]"><img class="alignnone size-thumbnail wp-image-524" title="bild-11-new-uiview-xib-name" src="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-11-new-uiview-xib-name-150x150.png" alt="bild-11-new-uiview-xib-name" width="150" height="150" /></a></p>
<p>Die Datei Tab1View.xib muss nun mit dem Interface Builder geöffnet werden. Für den &#8220;File&#8217;s Owner&#8221; wird im Identity Inspector als Class das NSObject durch Tab1ViewController ersetzt:</p>
<p><a href="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-12-tab1view-identity-inspector.png" rel="lightbox[513]"><img class="aligncenter size-thumbnail wp-image-525" title="bild-12-tab1view-identity-inspector" src="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-12-tab1view-identity-inspector-150x150.png" alt="bild-12-tab1view-identity-inspector" width="150" height="150" /></a></p>
<p>Anschließend muss das &#8220;New Referencing Outlet&#8221; der View mit dem Attribut view des &#8220;File&#8217;s Owner&#8221; verbunden werden. Dazu dient wieder ein Rechtsklick auf View und ein anschließendes Draggen des Krieses auf &#8220;File&#8217;s Owner&#8221;.</p>
<p>Um die View in der Tutorial-Applikation auch identifizieren zu können, wird ein entsprechendes Label in die View gezogen. Das Resultat sieht im Interface Builder dann so aus:</p>
<p><a href="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-13-tab1view.png" rel="lightbox[513]"><img class="aligncenter size-thumbnail wp-image-526" title="bild-13-tab1view" src="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-13-tab1view-150x150.png" alt="bild-13-tab1view" width="150" height="150" /></a></p>
<p>Das View muss nun noch entsprechend in der Tab Bar eingebunden werden. Die Idee dies direkt im Interface Builder zu machen ist zwar naheliegend und funktioniert auch prinzipiell &#8211; zumindest solange bis man dann versucht das Programm auszuführen, dann endet es mit einer Exception. Also muss man doch wieder zum Code greifen. Daher muss die App Delegate wir folgt angepasst werden:</p>
<p><tt>TutorialTabBarAppDelegate.h</tt>:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#import &lt;UIKit/UIKit.h&gt;</span><br />
<br />
<span style="color: #6e371a;">#import &quot;Tab1ViewController.h&quot;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // LINE ADDED</span><br />
<br />
<span style="color: #a61390;">@interface</span> TutorialTabBarAppDelegate <span style="color: #002200;">:</span> <span style="color: #400080;">NSObject</span> &lt;UIApplicationDelegate&gt; <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; UIWindow&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">*</span>window;<br />
&nbsp; &nbsp; UITabBarController&nbsp; <span style="color: #002200;">*</span>tabBarController;<br />
<br />
&nbsp; &nbsp; Tab1ViewController&nbsp; <span style="color: #002200;">*</span>tab1ViewController;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// LINE ADDED</span><br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> IBOutlet UIWindow &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">*</span>window;<br />
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> IBOutlet UITabBarController &nbsp; <span style="color: #002200;">*</span>tabBarController;<br />
<br />
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> Tab1ViewController&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">*</span>tab1ViewController;<span style="color: #11740a; font-style: italic;">// LINE ADDED</span><br />
<br />
<span style="color: #a61390;">@end</span></div></td></tr></tbody></table></div>
<p><tt>TutorialTabBarAppDelegate.m</tt>:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6e371a;">#import &quot;TutorialTabBarAppDelegate.h&quot;</span><br />
<br />
<span style="color: #a61390;">@implementation</span> TutorialTabBarAppDelegate<br />
<br />
<span style="color: #a61390;">@synthesize</span> window;<br />
<span style="color: #a61390;">@synthesize</span> tabBarController;<br />
<br />
<span style="color: #a61390;">@synthesize</span> tab1ViewController; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// LINE ADDED</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>applicationDidFinishLaunching<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIApplication <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>application <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; tab1ViewController <span style="color: #002200;">=</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// LINES ADDED</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>Tab1ViewController alloc<span style="color: #002200;">&#93;</span> initWithNibName<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Tab1View&quot;</span> bundle<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>tabBarController viewControllers<span style="color: #002200;">&#93;</span> objectAtIndex<span style="color: #002200;">:</span>0<span style="color: #002200;">&#93;</span> view<span style="color: #002200;">&#93;</span> addSubview<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>tab1ViewController view<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>window addSubview<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>tabBarController view<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// Override point for customization after application launch</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>window makeKeyAndVisible<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>dealloc <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>window release<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>super dealloc<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #a61390;">@end</span></div></td></tr></tbody></table></div>
<p>Äquivalent wird ein Tab2ViewController sowie eine Tab2View angelegt sowie im AppDelegate eingebaut. Das fertige Programm sieht dann wie folgt aus:</p>
<p style="text-align: center;"><a href="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-14-finished-tab-1.png" rel="lightbox[513]"><img class="alignnone size-thumbnail wp-image-527" title="bild-14-finished-tab-1" src="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-14-finished-tab-1-150x150.png" alt="bild-14-finished-tab-1" width="150" height="150" /></a> <a href="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-15-finished-tab-2.png" rel="lightbox[513]"><img class="alignnone size-thumbnail wp-image-528" title="bild-15-finished-tab-2" src="http://markus.ocrs.at/wp-content/uploads/2009/02/bild-15-finished-tab-2-150x150.png" alt="bild-15-finished-tab-2" width="150" height="150" /></a></p>
<p>Der fertige Sourcecode des Programms ist hier als Download verfügbar: <a href="http://markus.ocrs.at/wp-content/uploads/2009/02/tutorialtabbar.zip">TutorialTabBar (ZIP-Archiv)</a></p>
<p>Viel Erfolg beim Programmieren!</p>
]]></content:encoded>
			<wfw:commentRss>http://markus.ocrs.at/2009/02/27/iphone-development-tab-bar-mini-howto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2 Tage mit dem MacBook Pro</title>
		<link>http://markus.ocrs.at/2009/02/26/2-tage-mit-dem-macbook-pro/</link>
		<comments>http://markus.ocrs.at/2009/02/26/2-tage-mit-dem-macbook-pro/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 20:07:36 +0000</pubDate>
		<dc:creator>ComSubVie</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[MacBook Pro]]></category>
		<category><![CDATA[Notebook]]></category>

		<guid isPermaLink="false">http://markus.ocrs.at/?p=497</guid>
		<description><![CDATA[Nachdem letztens ja endlich mein neues Notebook angekommen ist, ist es wohl an der Zeit einen ersten Zwischenbericht zu schreiben.
Was ein bisschen auffällig an dem Notebook ist, ist dass das Display keinen mechanischen Verschluss mehr besitzt, sondern mit Magneten zugehalten wird. Und die sind so stark, das ich am Anfang das Display gar nicht hochklappen [...]]]></description>
			<content:encoded><![CDATA[<p>Nachdem letztens ja endlich mein neues Notebook angekommen ist, ist es wohl an der Zeit einen ersten Zwischenbericht zu schreiben.</p>
<p>Was ein bisschen auffällig an dem Notebook ist, ist dass das Display keinen mechanischen Verschluss mehr besitzt, sondern mit Magneten zugehalten wird. Und die sind so stark, das ich am Anfang das Display gar nicht hochklappen konnte (vor allem aus Angst irgendwas kaputt zu machen). Aber die Magnete halten da einfach so gut&#8230;</p>
<p>Die Installation ging problemlos, einfach einschalten, ein paar Fragen beantworten, und dann die Wiederherstellung vom TimeMachine-Backup starten. Das hat zwar länger gedauert als der Balken anfänglich behauptet hat, ging aber ohne irgendwelche Probleme (außer das ich auf das TimeMachine-Backup nicht mehr Backupen kann und daher ein neues anlegen muss, aber egal). Dann musste ich feststellen, dass das TimeMachine-Backup den <tt>/Developer</tt>-Ordner nicht synchronisiert hat, daher habe ich XCode neu installiert. Außerdem finde ich es interessant, das das Backup zwar iLife enthält, aber diese nicht restauriert hat, weil auf dem neuen Notebook das iLife 09 schon vorinstalliert war (und am Backup war nur iLife 08).</p>
<p>Softwaretechnisch gab es keinerlei Probleme, alles was vorher funktioniert hat funktioniert wie gewohnt weiter (Universal Binaries sind schon praktisch für so eine Umstellung), das neue iPhoto finde ich schon auch ganz nett, da werde ich wohl noch ein Zeiterl damit beschäftigt sein, Gesichter zu erkennen (teilweise erkennt er schon komische Dinge als Gesicht, und oft erkennt er Gesichter nicht als solche). Das mit den Places muss ich bei Gelegenheit auch noch austesten, aber dazu bin ich noch nicht gekommen.</p>
<p>Außerdem habe ich auch gleich eine iPhone-Applikation geschrieben, für XCode ist die hohe Auflösung des neuen Notebooks schon sehr praktisch. Hier ging die Entwicklung um einiges einfacher als zuvor, da ja das iPhone SDK eigentlich nur auf Intel läuft und für mein PowerBook ein paar Hacks erfordert hat. Die für die Entwicklung notwendigen Zertifikate wurden auch alle mitsynchronisiert. So problemlos wie das ging, werde ich mich dann wohl demnächst näher damit beschäftigen und vielleicht doch auch die eine oder andere Applikation in den Store werfen&#8230;</p>
<p>Das Einzige was mir irgendwie störend aufgefallen ist, ist dass sämtliche Anschlüsse auf der linken Seite des Notebooks sind. Das ist irgendwie unpraktisch, weil bei mir sind sowohl die Stromzufuhr als auch sämtliche externen Geräte auf der rechten Seite platziert (sowohl daheim am Schreibtisch, daheim im Bett als auch im Unterricht). Da muss ich mir noch irgendwas überlegen&#8230;</p>
<p>Sonst gibt es nicht wirklich etwas zu klagen, und die Akkulaufzeit ist wirklich sehr schön (ich weiß aber nicht ob ich die 8 Stunden wirklich schon mal geschafft habe, die Akkulaufzeit ist einfach so lang das man das nicht mehr vernünftig einschätzen kann).</p>
]]></content:encoded>
			<wfw:commentRss>http://markus.ocrs.at/2009/02/26/2-tage-mit-dem-macbook-pro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Das neue MacBook Pro ist da!!!</title>
		<link>http://markus.ocrs.at/2009/02/24/das-neue-macbook-pro-ist-da/</link>
		<comments>http://markus.ocrs.at/2009/02/24/das-neue-macbook-pro-ist-da/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 15:01:43 +0000</pubDate>
		<dc:creator>ComSubVie</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[MacBook Pro]]></category>
		<category><![CDATA[Notebook]]></category>

		<guid isPermaLink="false">http://markus.ocrs.at/?p=470</guid>
		<description><![CDATA[Hurra, es ist da! Nachdem mich UPS schon am Vormittag angerufen hat und gemeint hat, sie würden meine Adresse nicht finden (ich war da eh gerade im TGM), wurde das schöne Päckchen um 15:15 (nach langem Warten endlich) zugestellt.
Was man bekommt ist eine große Schachtel, in der gut verpackt die kleine MacBook Pro Schachtel steckt. [...]]]></description>
			<content:encoded><![CDATA[<p>Hurra, es ist da! Nachdem mich UPS schon am Vormittag angerufen hat und gemeint hat, sie würden meine Adresse nicht finden (ich war da eh gerade im TGM), wurde das schöne Päckchen um 15:15 (nach langem Warten endlich) zugestellt.</p>
<p>Was man bekommt ist eine große Schachtel, in der gut verpackt die kleine MacBook Pro Schachtel steckt. Die ist mit 7&#215;30x50 cm wirklich nicht sonderlich groß ausgefallen. Darin liegt wiederum gut verpackt das Goldstück, ein Netzteil mit Stecker bzw. Kabel, 2 Display-Adapter (auf VGA und DVI) sowie eine iWork 09 DVD, eine System-DVD und eine Applikations-DVD.</p>
<p>Ich habe gleich ein paar Fotos gemacht (im Moment ist das Notebook mit der Übertragung der Daten von meinem alten PowerBook beschäftigt), die kommen allerdings erst bei Gelegenheit online&#8230;</p>

<a href='http://markus.ocrs.at/2009/02/24/das-neue-macbook-pro-ist-da/img_7637/' title='img_7637'><img width="150" height="150" src="http://markus.ocrs.at/wp-content/uploads/2009/02/img_7637-150x150.jpg" class="attachment-thumbnail" alt="" title="img_7637" /></a>
<a href='http://markus.ocrs.at/2009/02/24/das-neue-macbook-pro-ist-da/img_7639/' title='img_7639'><img width="150" height="150" src="http://markus.ocrs.at/wp-content/uploads/2009/02/img_7639-150x150.jpg" class="attachment-thumbnail" alt="" title="img_7639" /></a>
<a href='http://markus.ocrs.at/2009/02/24/das-neue-macbook-pro-ist-da/img_7642/' title='img_7642'><img width="150" height="150" src="http://markus.ocrs.at/wp-content/uploads/2009/02/img_7642-150x150.jpg" class="attachment-thumbnail" alt="" title="img_7642" /></a>
<a href='http://markus.ocrs.at/2009/02/24/das-neue-macbook-pro-ist-da/img_7643/' title='img_7643'><img width="150" height="150" src="http://markus.ocrs.at/wp-content/uploads/2009/02/img_7643-150x150.jpg" class="attachment-thumbnail" alt="" title="img_7643" /></a>
<a href='http://markus.ocrs.at/2009/02/24/das-neue-macbook-pro-ist-da/img_7647/' title='img_7647'><img width="150" height="150" src="http://markus.ocrs.at/wp-content/uploads/2009/02/img_7647-150x150.jpg" class="attachment-thumbnail" alt="" title="img_7647" /></a>
<a href='http://markus.ocrs.at/2009/02/24/das-neue-macbook-pro-ist-da/img_7648/' title='img_7648'><img width="150" height="150" src="http://markus.ocrs.at/wp-content/uploads/2009/02/img_7648-150x150.jpg" class="attachment-thumbnail" alt="" title="img_7648" /></a>
<a href='http://markus.ocrs.at/2009/02/24/das-neue-macbook-pro-ist-da/img_7649/' title='img_7649'><img width="150" height="150" src="http://markus.ocrs.at/wp-content/uploads/2009/02/img_7649-150x150.jpg" class="attachment-thumbnail" alt="" title="img_7649" /></a>
<a href='http://markus.ocrs.at/2009/02/24/das-neue-macbook-pro-ist-da/img_7650/' title='img_7650'><img width="150" height="150" src="http://markus.ocrs.at/wp-content/uploads/2009/02/img_7650-150x150.jpg" class="attachment-thumbnail" alt="" title="img_7650" /></a>
<a href='http://markus.ocrs.at/2009/02/24/das-neue-macbook-pro-ist-da/img_7651/' title='img_7651'><img width="150" height="150" src="http://markus.ocrs.at/wp-content/uploads/2009/02/img_7651-150x150.jpg" class="attachment-thumbnail" alt="" title="img_7651" /></a>
<a href='http://markus.ocrs.at/2009/02/24/das-neue-macbook-pro-ist-da/img_7652/' title='img_7652'><img width="150" height="150" src="http://markus.ocrs.at/wp-content/uploads/2009/02/img_7652-150x150.jpg" class="attachment-thumbnail" alt="" title="img_7652" /></a>
<a href='http://markus.ocrs.at/2009/02/24/das-neue-macbook-pro-ist-da/img_7653/' title='img_7653'><img width="150" height="150" src="http://markus.ocrs.at/wp-content/uploads/2009/02/img_7653-150x150.jpg" class="attachment-thumbnail" alt="" title="img_7653" /></a>
<a href='http://markus.ocrs.at/2009/02/24/das-neue-macbook-pro-ist-da/img_7654/' title='img_7654'><img width="150" height="150" src="http://markus.ocrs.at/wp-content/uploads/2009/02/img_7654-150x150.jpg" class="attachment-thumbnail" alt="" title="img_7654" /></a>

]]></content:encoded>
			<wfw:commentRss>http://markus.ocrs.at/2009/02/24/das-neue-macbook-pro-ist-da/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Neues Notebook unterwegs!!!</title>
		<link>http://markus.ocrs.at/2009/02/17/neues-notebook-unterwegs/</link>
		<comments>http://markus.ocrs.at/2009/02/17/neues-notebook-unterwegs/#comments</comments>
		<pubDate>Mon, 16 Feb 2009 23:27:20 +0000</pubDate>
		<dc:creator>ComSubVie</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[MacBook Pro]]></category>
		<category><![CDATA[Notebook]]></category>

		<guid isPermaLink="false">http://markus.ocrs.at/?p=439</guid>
		<description><![CDATA[Hurra, mein neues Notebook wurde versendet:
Ihre Bestellung wurde versendet am 16.02.2009. Wir bestätigen, dass Ihre Bestellung voraussichtlich am oder vor dem 25.02.2009 an Ihre Lieferadresse geliefert wird.
Ich kanns gar nicht mehr erwarten&#8230;
]]></description>
			<content:encoded><![CDATA[<p>Hurra, mein <a href="http://markus.ocrs.at/2009/01/09/neues-17-macbook-pro/">neues</a> <a href="http://store.apple.com/at/configure/MB604D/A?mco=MzA3MTE5OA">Notebook</a> wurde versendet:</p>
<blockquote><p>Ihre Bestellung wurde versendet am 16.02.2009. Wir bestätigen, dass Ihre Bestellung voraussichtlich am oder vor dem 25.02.2009 an Ihre Lieferadresse geliefert wird.</p></blockquote>
<p>Ich kanns gar nicht mehr erwarten&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://markus.ocrs.at/2009/02/17/neues-notebook-unterwegs/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Siftables</title>
		<link>http://markus.ocrs.at/2009/02/15/siftables/</link>
		<comments>http://markus.ocrs.at/2009/02/15/siftables/#comments</comments>
		<pubDate>Sun, 15 Feb 2009 19:30:41 +0000</pubDate>
		<dc:creator>ComSubVie</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[Wissenschaft]]></category>
		<category><![CDATA[Computer]]></category>
		<category><![CDATA[Gadgets]]></category>
		<category><![CDATA[MIT]]></category>

		<guid isPermaLink="false">http://markus.ocrs.at/?p=434</guid>
		<description><![CDATA[Siftables sind eine Entwicklung des MIT Media Lab. Im Prinzip handelt es sich dabei um Mini-Computer mit eingebautem Bildschirm, die Beschleunigungssensoren beinhalten und erkennen wenn sie sich nahe kommen. Man kann daher auf jedem der Bausteine irgendwelche Informationen darstellen, und durch physikalische Nähe der Bausteine diese miteinander interagieren lassen. Ein entsprechendes Beispiel dafür ist die [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.siftables.com/">Siftables</a> sind eine Entwicklung des <a href="http://www.media.mit.edu/">MIT Media Lab</a>. Im Prinzip handelt es sich dabei um Mini-Computer mit eingebautem Bildschirm, die Beschleunigungssensoren beinhalten und erkennen wenn sie sich nahe kommen. Man kann daher auf jedem der Bausteine irgendwelche Informationen darstellen, und durch physikalische Nähe der Bausteine diese miteinander interagieren lassen. Ein entsprechendes Beispiel dafür ist die Generierung der Fibonacci-Sequenz:</p>
<p style="text-align: center;"><object width="400" height="225" data="http://vimeo.com/moogaloop.swf?clip_id=3164229&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=3164229&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /></object></p>
<p>Ebenso genial finde ich den Music Sequencer:</p>
<p style="text-align: center;"><object width="400" height="225" data="http://vimeo.com/moogaloop.swf?clip_id=3165011&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=3165011&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /></object></p>
<p>Das ganze Projekt wurde (sehr gut) in einer TED Präsentation vorgeführt:</p>
<p style="text-align: center;"><object width="446" height="326" data="http://video.ted.com/assets/player/swf/EmbedPlayer.swf" type="application/x-shockwave-flash"><param name="allowFullScreen" value="true" /><param name="wmode" value="transparent" /><param name="bgColor" value="#ffffff" /><param name="flashvars" value="vu=http://video.ted.com/talks/embed/DavidMerrill_2009-embed_high.flv&amp;su=http://images.ted.com/images/ted/tedindex/embed-posters/DavidMerrill-2009.embed_thumbnail.jpg&amp;vw=432&amp;vh=240&amp;ap=0&amp;ti=457" /><param name="src" value="http://video.ted.com/assets/player/swf/EmbedPlayer.swf" /><param name="bgcolor" value="#ffffff" /><param name="allowfullscreen" value="true" /></object></p>
<p>Ich bin mir zwar noch nicht wirklich sicher, ob es für das ganze sinnvolle Anwendungen gibt, aber ich finde es trotzdem ziemlich cool. Ich will sowas haben &#8211; auch wenn ich nicht weiß was ich damit machen soll&#8230;</p>
<p>Nähere Informationen finden sich im <a href="http://blog.tacolab.com/">Taco Lab Blog</a> und auf der <a href="http://www.siftables.com/">Homepage</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://markus.ocrs.at/2009/02/15/siftables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>time_t 1234567890</title>
		<link>http://markus.ocrs.at/2009/02/12/time_t-1234567890/</link>
		<comments>http://markus.ocrs.at/2009/02/12/time_t-1234567890/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 22:19:09 +0000</pubDate>
		<dc:creator>ComSubVie</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Computer]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://markus.ocrs.at/?p=418</guid>
		<description><![CDATA[Da ich annehmen darf, dass die meisten die diese Seite hier lesen ohnehin leicht einseitig vorbelastet sind, erspare ich mir die Erklärung, was denn time_t heißt, oder was ein Unix-Timestamp ist und so weiter. Egal, wenn man in seinem Terminal das folgende eingibt:
1$ date -r 1234567890
Dann sollte man in etwa das folgende Ergebnis bekommen (je [...]]]></description>
			<content:encoded><![CDATA[<p>Da ich annehmen darf, dass die meisten die diese Seite hier lesen ohnehin leicht einseitig vorbelastet sind, erspare ich mir die Erklärung, was denn <tt>time_t</tt> heißt, oder was ein Unix-Timestamp ist und so weiter. Egal, wenn man in seinem Terminal das folgende eingibt:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ date -r 1234567890</div></td></tr></tbody></table></div>
<p>Dann sollte man in etwa das folgende Ergebnis bekommen (je nach Zeitzone möglicherweise unterschiedlich, aber der Zeitpunkt sollte überall gleich sein):</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Sa 14 Feb 2009 00:31:30 CET</div></td></tr></tbody></table></div>
<p>Ich denke das sollte schon irgendwie gefeiert werden&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://markus.ocrs.at/2009/02/12/time_t-1234567890/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Programming is hard</title>
		<link>http://markus.ocrs.at/2009/02/12/programming-is-hard/</link>
		<comments>http://markus.ocrs.at/2009/02/12/programming-is-hard/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 19:55:03 +0000</pubDate>
		<dc:creator>ComSubVie</dc:creator>
				<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Links]]></category>

		<guid isPermaLink="false">http://markus.ocrs.at/?p=415</guid>
		<description><![CDATA[Bei meinen mehr-oder-weniger täglichen Blog-Exkursionen bin ich heute über Jon Skeed: Coding Blog gestolpert (igitt, ASP). Für .net Programmierer sicher sehr lesenswert, für alle anderen nicht so der Bringer. Aber den Artikel Programming is hard fand ich ganz nett:


If your code deals with arbitrary human text, it&#8217;s probably broken. (Have you taken the Turkey test recently?)
If your [...]]]></description>
			<content:encoded><![CDATA[<p>Bei meinen mehr-oder-weniger täglichen Blog-Exkursionen bin ich heute über <a href="http://msmvps.com/blogs/jon_skeet/default.aspx">Jon Skeed: Coding Blog</a> gestolpert (igitt, ASP). Für .net Programmierer sicher sehr lesenswert, für alle anderen nicht so der Bringer. Aber den Artikel <a href="http://msmvps.com/blogs/jon_skeet/archive/2009/01/29/programming-is-hard.aspx">Programming is hard</a> fand ich ganz nett:</p>
<blockquote>
<ul>
<li>If your code deals with arbitrary human text, it&#8217;s probably broken. (Have you taken the <a href="http://www.moserware.com/2008/02/does-your-code-pass-turkey-test.html">Turkey test</a> recently?)</li>
<li>If your code deals with floating point numbers, it&#8217;s probably broken.</li>
<li>If your code deals with concurrency (whether that means database transactions, threading, whatever), it&#8217;s probably broken.</li>
<li>If your code deals with dates, times and time zones, it&#8217;s probably broken. (Time zones in particular are hideous.)</li>
<li>If your code has a user interface with anything other than a fixed size and a fixed set of labels (no i18n), it&#8217;s probably broken.</li>
</ul>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://markus.ocrs.at/2009/02/12/programming-is-hard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lego Turing Machine</title>
		<link>http://markus.ocrs.at/2009/01/30/lego-turing-machine/</link>
		<comments>http://markus.ocrs.at/2009/01/30/lego-turing-machine/#comments</comments>
		<pubDate>Fri, 30 Jan 2009 10:03:26 +0000</pubDate>
		<dc:creator>ComSubVie</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Wissenschaft]]></category>
		<category><![CDATA[Lego]]></category>
		<category><![CDATA[Turing]]></category>

		<guid isPermaLink="false">http://markus.ocrs.at/?p=296</guid>
		<description><![CDATA[Da gibt es ein paar Irre, die eine Turing Maschine in Lego nachgebaut haben. Dazu gibt es auch ein Demo-/Werbevideo, sehr nett *willhaben*

]]></description>
			<content:encoded><![CDATA[<p>Da gibt es ein paar Irre, die eine <a href="http://legoofdoom.blogspot.com/">Turing Maschine in Lego</a> nachgebaut haben. Dazu gibt es auch ein Demo-/Werbevideo, sehr nett *willhaben*</p>
<p style="text-align: center;"><!-- Smart Youtube --><span class="youtube"><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/cYw2ewoO6c4&amp;rel=1&amp;color1=d6d6d6&amp;color2=f0f0f0&amp;border=&amp;fs=1&amp;hl=en&amp;autoplay=&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0" /><param name="allowFullScreen" value="true" /><embed wmode="transparent" src="http://www.youtube.com/v/cYw2ewoO6c4&amp;rel=1&amp;color1=d6d6d6&amp;color2=f0f0f0&amp;border=&amp;fs=1&amp;hl=en&amp;autoplay=&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="355" ></embed><param name="wmode" value="transparent" /></object></span></p>
]]></content:encoded>
			<wfw:commentRss>http://markus.ocrs.at/2009/01/30/lego-turing-machine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Teensy AVR &amp; Mac AVR-GCC</title>
		<link>http://markus.ocrs.at/2009/01/30/teensy-avr-mac-avr-gcc/</link>
		<comments>http://markus.ocrs.at/2009/01/30/teensy-avr-mac-avr-gcc/#comments</comments>
		<pubDate>Fri, 30 Jan 2009 09:52:42 +0000</pubDate>
		<dc:creator>ComSubVie</dc:creator>
				<category><![CDATA[AVR]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Microcontroller]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[USB]]></category>

		<guid isPermaLink="false">http://markus.ocrs.at/?p=294</guid>
		<description><![CDATA[Ich habe gerade ein recht günstiges AVR Starterkit gefunden, das Teensy USB Development Board ($19), welches einen AVR AT90USB162 beinhaltet (ok, ein ATxmega irgendwas wäre mir lieber, aber immerhin), einige I/O Pins beinhaltet und direkt über USB programmiert werden kann (unter allen gängigen Betriebssystemen, inclusive OS X).
Zusätzlich habe ich das AVR MacPack entdeckt, welches im [...]]]></description>
			<content:encoded><![CDATA[<p>Ich habe gerade ein recht günstiges AVR Starterkit gefunden, das <a href="http://www.pjrc.com/teensy/">Teensy USB Development Board</a> ($19), welches einen AVR AT90USB162 beinhaltet (ok, ein ATxmega irgendwas wäre mir lieber, aber immerhin), einige I/O Pins beinhaltet und direkt über USB programmiert werden kann (unter allen gängigen Betriebssystemen, inclusive OS X).</p>
<p>Zusätzlich habe ich das <a href="http://www.obdev.at/products/avrmacpack/download.html">AVR MacPack</a> entdeckt, welches im Prinzip nur der AVR GCC für OS X ist. Das ist zumindest für jene Leute interessant, die AVRs programmieren wollen, aber die benötigte Software nicht unbedingt über DarwinPorts installieren wollen. Das MacPack scheint auch regelmäßig aktualisiert zu werden.</p>
]]></content:encoded>
			<wfw:commentRss>http://markus.ocrs.at/2009/01/30/teensy-avr-mac-avr-gcc/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Java ist komisch</title>
		<link>http://markus.ocrs.at/2009/01/29/java-ist-komisch/</link>
		<comments>http://markus.ocrs.at/2009/01/29/java-ist-komisch/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 22:59:58 +0000</pubDate>
		<dc:creator>ComSubVie</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programmieren]]></category>

		<guid isPermaLink="false">http://markus.ocrs.at/?p=286</guid>
		<description><![CDATA[Nachdem wir heute am TGM eine kleine Diskussion hatten, wobei der Christoph behauptet hat, dass man in Java zu einem char kein int addieren kann, und ich das einfach nicht glauben konnte, musste ich das gleich mal probieren. Und er hatte fast recht. Beim ersten Versuch gelang es mir nicht, den Fehler zu erzeugen, aber [...]]]></description>
			<content:encoded><![CDATA[<p>Nachdem wir heute am TGM eine kleine Diskussion hatten, wobei der Christoph behauptet hat, dass man in Java zu einem <tt>char</tt> kein <tt>int</tt> addieren kann, und ich das einfach nicht glauben konnte, musste ich das gleich mal probieren. Und er hatte fast recht. Beim ersten Versuch gelang es mir nicht, den Fehler zu erzeugen, aber ich habe es dann doch geschafft:</p>
<p>Wenn man (also typischer Java-Programmierer, also nicht schreibfaul) programmiert ist das eigentlich einfach zu erreichen. Der folgende Code liefert beim Kompilieren eine entsprechende Fehlermeldung (<em>possible loss of precision</em> - was ja durchaus nicht falsch ist, wobei das eigentlich nur eine Warnung sein sollte, und kein Fehler, aber da ist Java ja sowieso ein bisschen komisch):</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Test <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span> <span style="color: #003399;">String</span> args <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">char</span> zeichen <span style="color: #339933;">=</span> <span style="color: #0000ff;">'a'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> x <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; zeichen <span style="color: #339933;">=</span> zeichen <span style="color: #339933;">+</span> x<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span> zeichen <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>Wobei die vom C-Programmierer favorisierte kurze Schreibweise (die auch mein erster Versuch war) problemlos funktioniert und beim Ausführen auch das erwartete Ergebnis zurückliefert:</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Test <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span> <span style="color: #003399;">String</span> args <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">char</span> zeichen <span style="color: #339933;">=</span> <span style="color: #0000ff;">'a'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> x <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; zeichen <span style="color: #339933;">+=</span> x<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span> zeichen <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>Eine alternative funktionierende Lösung wäre ein entsprechendes Casten:</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Test <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span> <span style="color: #003399;">String</span> args <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">char</span> zeichen <span style="color: #339933;">=</span> <span style="color: #0000ff;">'a'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> x <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; zeichen <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">char</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>zeichen <span style="color: #339933;">+</span> x<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span> zeichen <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>Abschließend kann man sagen, dass sich Java da zwar schon ein bisschen seltsam verhält (es bringt zum Beispiel auch nichts nur das <tt>x</tt> auf <tt>char</tt> zu casten, man muss das Ergebnis der Addition casten. Aber zumindest funktioniert eine Addition sehr wohl, wobei die Nichtfunktionalität ja eh niemand so wirklich glauben wollte&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://markus.ocrs.at/2009/01/29/java-ist-komisch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
