<?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>dev.enekoalonso.com &#187; iphone</title>
	<atom:link href="http://dev.enekoalonso.com/tag/iphone/feed/" rel="self" type="application/rss+xml" />
	<link>http://dev.enekoalonso.com</link>
	<description>having fun with code</description>
	<lastBuildDate>Sat, 31 Jul 2010 05:51:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Titanium Developer: love and hate</title>
		<link>http://dev.enekoalonso.com/2010/07/30/titanium-developer-love-and-hate/</link>
		<comments>http://dev.enekoalonso.com/2010/07/30/titanium-developer-love-and-hate/#comments</comments>
		<pubDate>Sat, 31 Jul 2010 04:57:16 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[appcelerator]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[developer]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[pc]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[titanium]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=615</guid>
		<description><![CDATA[I&#8217;ve been using Titanium Developer for a while now, since I installed it to do some mobile app research one or two months ago. But up until now I barely used it again other than to maintain a desktop app I created for a game, which thanks to Titanium runs in both Mac and PC. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using <a href="http://www.appcelerator.com/products/titanium-mobile-application-development/">Titanium Developer</a> for a while now, since I installed it to do some mobile app research one or two months ago. But up until now I barely used it again other than to maintain a desktop app I created for a game, which thanks to Titanium runs in both Mac and PC. Thus, up until this week, I hadn&#8217;t really get in depth with it.</p>
<h3>The good things</h3>
<p>Nice, easy and fast. Creating apps is piece of cake, loading JSON feeds from Internet, using local storage, placing buttons and labels on the screen&#8230; it&#8217;s all easy and it works on both iPhone and Android right away.</p>
<h3>The bad things</h3>
<p>Titanium Developer looks like an unfinished app. It shouldn&#8217;t be version 1.X, not even 0.X. Looks like an alpha, buggy and very easy to get screwed up, specially if you share your projects between Windows and Mac. This time it launches the emulator, this time it does not. This time your project does not load properly. Next time, you try to create a new project and it fails. And the errors are totally useless. Not very helpful.</p>
<h3>Conclusion</h3>
<p>The idea is great, awesome. The code is clean and using Javascript for development makes it easy for web developers to get easily involved into mobile app development. If only the <a href="http://twitter.com/appcelerator">Appcelerator</a> team could improve their app, we would save a lot of headaches.</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>February 19, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/19/having-fun-with-mooml-and-twitter/" title="Having fun with Mooml &#038; Twitter">Having fun with Mooml &#038; Twitter</a> (0)</li><li>January 28, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/28/things-to-do/" title="Things to do">Things to do</a> (0)</li><li>August 29, 2009 -- <a href="http://dev.enekoalonso.com/2009/08/29/spaniards-for-iphone-available-now/" title="Spaniards for iPhone available now">Spaniards for iPhone available now</a> (0)</li><li>June 30, 2009 -- <a href="http://dev.enekoalonso.com/2009/06/30/iphone-3-0-geolocation-with-javascript/" title="iPhone 3.0 geolocation with Javascript">iPhone 3.0 geolocation with Javascript</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/07/30/titanium-developer-love-and-hate/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Things to do</title>
		<link>http://dev.enekoalonso.com/2010/01/28/things-to-do/</link>
		<comments>http://dev.enekoalonso.com/2010/01/28/things-to-do/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 04:15:44 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[appcelerator]]></category>
		<category><![CDATA[closure]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[sdk]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[yql]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=418</guid>
		<description><![CDATA[To do list: Try Appcelerator (downloaded.. don&#8217;t like it very much, have to spend more time with it) Install iPhone SDK 3.2 (downloading installing&#8230;) Study LinkedIn API Study Twitter API Take a look at YQL Play with Google Closure JS library Play with Dojo JS library That&#8217;s it for now. Let&#8217;s see if I can [...]]]></description>
			<content:encoded><![CDATA[<p>To do list:</p>
<ul>
<li><del datetime="2010-01-31T00:52:29+00:00">Try <a href="http://www.appcelerator.com/">Appcelerator</a></del> (downloaded.. don&#8217;t like it very much, have to spend more time with it)</li>
<li><del datetime="2010-01-31T01:29:38+00:00">Install <a href="http://developer.apple.com/iphone">iPhone SDK 3.2</a> (<del datetime="2010-01-31T00:52:29+00:00">downloading</del> installing&#8230;)</del></li>
<li>Study <a href="http://developer.linkedin.com/community/apis">LinkedIn API</a></li>
<li>Study <a href="http://apiwiki.twitter.com/">Twitter API</a></li>
<li>Take a look at <a href="http://developer.yahoo.com/yql/">YQL</a></li>
<li>Play with <a href="http://code.google.com/closure/library">Google Closure</a> JS library</li>
<li>Play with <a href="http://dojotoolkit.org/">Dojo</a> JS library</li>
</ul>
<p>That&#8217;s it for now. Let&#8217;s see if I can find time to do all those.</p>
<h4>Updated</h4>
<p><a href="http://dev.enekoalonso.com/wp-content/uploads/2010/01/Screen-shot-2010-01-30-at-5.37.52-PM.png"><img src="http://dev.enekoalonso.com/wp-content/uploads/2010/01/Screen-shot-2010-01-30-at-5.37.52-PM-396x300.png" alt="" title="XCode with SDK 3.2 for iPad" width="396" height="300" class="aligncenter size-medium wp-image-439" /></a></p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>May 6, 2010 -- <a href="http://dev.enekoalonso.com/2010/05/06/tech-talks-at-level-studios/" title="Tech talks at LEVEL Studios">Tech talks at LEVEL Studios</a> (0)</li><li>January 28, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/28/dojo-y-yo/" title="Dojo y yo">Dojo y yo</a> (0)</li><li>June 30, 2009 -- <a href="http://dev.enekoalonso.com/2009/06/30/iphone-3-0-geolocation-with-javascript/" title="iPhone 3.0 geolocation with Javascript">iPhone 3.0 geolocation with Javascript</a> (1)</li><li>July 30, 2010 -- <a href="http://dev.enekoalonso.com/2010/07/30/creating-qr-codes-with-google-charts-api/" title="Creating QR Codes with Google Charts API">Creating QR Codes with Google Charts API</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/01/28/things-to-do/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spaniards for iPhone available now</title>
		<link>http://dev.enekoalonso.com/2009/08/29/spaniards-for-iphone-available-now/</link>
		<comments>http://dev.enekoalonso.com/2009/08/29/spaniards-for-iphone-available-now/#comments</comments>
		<pubDate>Sat, 29 Aug 2009 22:43:09 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[appstore]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[spaniards]]></category>
		<category><![CDATA[spaniards.es]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=373</guid>
		<description><![CDATA[Finally, the first release of Spaniards Mobile got released just today and it is available for download on the App Store for FREE. More info: http://www.spaniards.es/noticias/2009/08/29/spaniards-10-para-iphone-ya-disponible Related Posts:July 30, 2010 -- Titanium Developer: love and hate (2)January 30, 2010 -- Got new servers on Rackspace Cloud (5)January 28, 2010 -- Things to do (0)July 26, [...]]]></description>
			<content:encoded><![CDATA[<p>Finally, the first release of Spaniards Mobile got released just today and it is available for download on the App Store for FREE.</p>
<p>More info:<br />
<a href="http://www.spaniards.es/noticias/2009/08/29/spaniards-10-para-iphone-ya-disponible">http://www.spaniards.es/noticias/2009/08/29/spaniards-10-para-iphone-ya-disponible</a></p>
<p align="center"><img src="http://www.spaniards.es/archivos/IMG_0627.PNG" alt="Spaniards for iPhone" /></p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>July 30, 2010 -- <a href="http://dev.enekoalonso.com/2010/07/30/titanium-developer-love-and-hate/" title="Titanium Developer: love and hate">Titanium Developer: love and hate</a> (2)</li><li>January 30, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/30/got-new-servers-on-rackspace-cloud/" title="Got new servers on Rackspace Cloud">Got new servers on Rackspace Cloud</a> (5)</li><li>January 28, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/28/things-to-do/" title="Things to do">Things to do</a> (0)</li><li>July 26, 2009 -- <a href="http://dev.enekoalonso.com/2009/07/26/placing-a-uiactivityindicartorview-on-a-uibarbuttonitem/" title="Placing a UIActivityIndicartorView on a UIBarButtonItem">Placing a UIActivityIndicartorView on a UIBarButtonItem</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2009/08/29/spaniards-for-iphone-available-now/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Placing a UIActivityIndicartorView on a UIBarButtonItem</title>
		<link>http://dev.enekoalonso.com/2009/07/26/placing-a-uiactivityindicartorview-on-a-uibarbuttonitem/</link>
		<comments>http://dev.enekoalonso.com/2009/07/26/placing-a-uiactivityindicartorview-on-a-uibarbuttonitem/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 21:36:39 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[cocoa]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[reload]]></category>
		<category><![CDATA[UIActivityIndicatorView]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=347</guid>
		<description><![CDATA[Have you seen those iPhone apps with a reload button that switches itself to an animated activity indicator while the reload action is being performed? Here is how to do that. Place this code on your ViewController: - &#40;void&#41;showReloadButton &#123; &#160; UIBarButtonItem *refreshItem = &#91;&#91;UIBarButtonItem alloc&#93; &#160; &#160; initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh &#160; &#160; &#160; &#160; &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Have you seen those iPhone apps with a reload button that switches itself to an animated activity indicator while the reload action is being performed? </p>
<p>Here is how to do that. Place this code on your ViewController:</p>
<div class="geshi no objc">
<ol>
<li class="li1">
<div class="de1"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>showReloadButton <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; UIBarButtonItem <span class="sy0">*</span>refreshItem <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UIBarButtonItem alloc<span class="br0">&#93;</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; initWithBarButtonSystemItem<span class="sy0">:</span>UIBarButtonSystemItemRefresh </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; target<span class="sy0">:</span>self</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; action<span class="sy0">:</span><span class="kw4">@selector</span><span class="br0">&#40;</span>reload<span class="sy0">:</span><span class="br0">&#41;</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; self.navigationItem.rightBarButtonItem <span class="sy0">=</span> refreshItem;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#91;</span>refreshItem release<span class="br0">&#93;</span>; </div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>showActivityIndicator <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; UIActivityIndicatorView <span class="sy0">*</span>activityIndicator <span class="sy0">=</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#91;</span><span class="br0">&#91;</span>UIActivityIndicatorView alloc<span class="br0">&#93;</span> initWithFrame<span class="sy0">:</span>CGRectMake<span class="br0">&#40;</span><span class="nu0">0</span>, <span class="nu0">0</span>, <span class="nu0">20</span>, <span class="nu0">20</span><span class="br0">&#41;</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#91;</span>activityIndicator startAnimating<span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; UIBarButtonItem <span class="sy0">*</span>activityItem <span class="sy0">=</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#91;</span><span class="br0">&#91;</span>UIBarButtonItem alloc<span class="br0">&#93;</span> initWithCustomView<span class="sy0">:</span>activityIndicator<span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#91;</span>activityIndicator release<span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; self.navigationItem.rightBarButtonItem <span class="sy0">=</span> activityItem;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#91;</span>activityItem release<span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> reload <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="co1">// Do your reload stuff</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>Seen <a href="http://www.leegillen.com/Public/Blog/Entries/2008/10/26_How_to_use_a_custom_UIBarButtonItem_to_display_a_UIActivityIndicatorView.html">here</a>.</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>July 30, 2009 -- <a href="http://dev.enekoalonso.com/2009/07/30/trimming-strings-objective-c-cocoa/" title="Trimming strings in Objective-C / Cocoa">Trimming strings in Objective-C / Cocoa</a> (0)</li><li>November 28, 2008 -- <a href="http://dev.enekoalonso.com/2008/11/28/mygameoflife-source-code/" title="MyGameOfLife source code">MyGameOfLife source code</a> (0)</li><li>July 30, 2010 -- <a href="http://dev.enekoalonso.com/2010/07/30/titanium-developer-love-and-hate/" title="Titanium Developer: love and hate">Titanium Developer: love and hate</a> (2)</li><li>January 28, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/28/things-to-do/" title="Things to do">Things to do</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2009/07/26/placing-a-uiactivityindicartorview-on-a-uibarbuttonitem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone 3.0 geolocation with Javascript</title>
		<link>http://dev.enekoalonso.com/2009/06/30/iphone-3-0-geolocation-with-javascript/</link>
		<comments>http://dev.enekoalonso.com/2009/06/30/iphone-3-0-geolocation-with-javascript/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 16:13:43 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[geolocation]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[maps]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[safari]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=338</guid>
		<description><![CDATA[I was watching one of the video tutorials from Apple last night about some custom JS available on Safari, only on the iPhone 3.0, that let’s you interact with the phone and obtain data like the current location, etc. So I built a little page to see how it works. I included Mootools 1.2.3 from [...]]]></description>
			<content:encoded><![CDATA[<p>I was watching one of the video tutorials from Apple last night about some custom JS available on Safari, only on the iPhone 3.0, that let’s you interact with the phone and obtain data like the current location, etc.</p>
<p>So I built a little page to see how it works. I included Mootools 1.2.3 from Google servers and the Google Maps API. And voilá, with a few lines of code we have a totally functional web based GSP navigation system. A little bit ugly, but functional. Currenlty it only centers the map on the coordinates given by the phone, and also does a reverse geolocation to obtain the address (actually city, state and country). But it could be easily extended to add markers to the map, or even paths to track the movement.</p>
<p>If you have an iPhone (or an iPhone simulator) go to:<br />
<a href="http://enekoalonso.com/research/iphone/geolocation.html">http://enekoalonso.com/research/iphone/geolocation.html</a></p>
<p>The source code:</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">var</span> Navigator = <span class="kw2">new</span> <span class="kw2">Class</span><span class="br0">&#40;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; initialize: <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">// Listen for position changes</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">this</span>.<span class="me1">watchId</span> = navigator.<span class="me1">geolocation</span>.<span class="me1">watchPosition</span><span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="kw2">function</span><span class="br0">&#40;</span>position<span class="br0">&#41;</span><span class="br0">&#123;</span> <span class="kw1">this</span>.<span class="me1">position</span><span class="br0">&#40;</span>position<span class="br0">&#41;</span> <span class="br0">&#125;</span>.<span class="me1">bind</span><span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><span class="br0">&#125;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> enableHighAccuracy: <span class="kw2">true</span>, timeout: <span class="nu0">1000</span>, maximumAge: <span class="nu0">10000</span> <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">this</span>.<span class="me1">infoPanel</span> = $<span class="br0">&#40;</span><span class="st0">&#39;info&#39;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">// Create the Geocoder and the Map</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">this</span>.<span class="me1">geocoder</span> = <span class="kw2">new</span> google.<span class="me1">maps</span>.<span class="me1">Geocoder</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">this</span>.<span class="me1">map</span> = <span class="kw2">new</span> google.<span class="me1">maps</span>.<span class="me1">Map</span><span class="br0">&#40;</span>$<span class="br0">&#40;</span><span class="st0">&#39;map&#39;</span><span class="br0">&#41;</span>, <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; zoom: <span class="nu0">12</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; mapTypeId: google.<span class="me1">maps</span>.<span class="me1">MapTypeId</span>.<span class="me1">ROADMAP</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; position: <span class="kw2">function</span><span class="br0">&#40;</span>position<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">// Update labels</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">this</span>.<span class="me1">infoPanel</span>.<span class="me1">getElement</span><span class="br0">&#40;</span><span class="st0">&#39;p.date&#39;</span><span class="br0">&#41;</span>.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">&#39;text&#39;</span>, position.<span class="me1">timestamp</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">this</span>.<span class="me1">infoPanel</span>.<span class="me1">getElement</span><span class="br0">&#40;</span><span class="st0">&#39;p.coords&#39;</span><span class="br0">&#41;</span>.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">&#39;text&#39;</span>, position.<span class="me1">coords</span>.<span class="me1">latitude</span> + <span class="st0">&#39;, &#39;</span> + position.<span class="me1">coords</span>.<span class="me1">longitude</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">this</span>.<span class="me1">infoPanel</span>.<span class="me1">getElement</span><span class="br0">&#40;</span><span class="st0">&#39;p.altitude&#39;</span><span class="br0">&#41;</span>.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">&#39;text&#39;</span>, position.<span class="me1">coords</span>.<span class="me1">altitude</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">this</span>.<span class="me1">infoPanel</span>.<span class="me1">getElement</span><span class="br0">&#40;</span><span class="st0">&#39;p.heading&#39;</span><span class="br0">&#41;</span>.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">&#39;text&#39;</span>, position.<span class="me1">coords</span>.<span class="me1">heading</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">this</span>.<span class="me1">infoPanel</span>.<span class="me1">getElement</span><span class="br0">&#40;</span><span class="st0">&#39;p.speed&#39;</span><span class="br0">&#41;</span>.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">&#39;text&#39;</span>, position.<span class="me1">coords</span>.<span class="me1">speed</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">// Center map</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">var</span> latLng = <span class="kw2">new</span> google.<span class="me1">maps</span>.<span class="me1">LatLng</span><span class="br0">&#40;</span>position.<span class="me1">coords</span>.<span class="me1">latitude</span>, position.<span class="me1">coords</span>.<span class="me1">longitude</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">this</span>.<span class="me1">map</span>.<span class="me1">set_center</span><span class="br0">&#40;</span>latLng<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">// Reverse geolocation (get current address)</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">this</span>.<span class="me1">geocoder</span>.<span class="me1">geocode</span><span class="br0">&#40;</span><span class="br0">&#123;</span><span class="st0">&#39;latLng&#39;</span>: latLng<span class="br0">&#125;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="kw2">function</span><span class="br0">&#40;</span>results, <span class="kw3">status</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>google.<span class="me1">maps</span>.<span class="me1">GeocoderStatus</span>.<span class="me1">OK</span><span class="br0">&#41;</span> <span class="kw1">this</span>.<span class="me1">showAddress</span><span class="br0">&#40;</span>results<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span>.<span class="me1">bind</span><span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; showAddress: <span class="kw2">function</span><span class="br0">&#40;</span>results<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">// console.dir(response);</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>results<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="kw1">this</span>.<span class="me1">infoPanel</span>.<span class="me1">getElement</span><span class="br0">&#40;</span><span class="st0">&#39;p.location&#39;</span><span class="br0">&#41;</span>.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">&#39;text&#39;</span>, results<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span>.<span class="me1">formatted_address</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">window.<span class="me1">addEvent</span><span class="br0">&#40;</span><span class="st0">&#39;load&#39;</span>, <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">new</span> Navigator<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>Enjoy.</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>February 19, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/19/having-fun-with-mooml-and-twitter/" title="Having fun with Mooml &#038; Twitter">Having fun with Mooml &#038; Twitter</a> (0)</li><li>January 28, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/28/things-to-do/" title="Things to do">Things to do</a> (0)</li><li>February 28, 2009 -- <a href="http://dev.enekoalonso.com/2009/02/28/kyte-rest-api/" title="Kyte&#8217;s REST API">Kyte&#8217;s REST API</a> (0)</li><li>July 30, 2010 -- <a href="http://dev.enekoalonso.com/2010/07/30/creating-qr-codes-with-google-charts-api/" title="Creating QR Codes with Google Charts API">Creating QR Codes with Google Charts API</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2009/06/30/iphone-3-0-geolocation-with-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Handling events on iPhone webapps</title>
		<link>http://dev.enekoalonso.com/2008/12/05/handling-events-on-iphone-webapps/</link>
		<comments>http://dev.enekoalonso.com/2008/12/05/handling-events-on-iphone-webapps/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 22:02:29 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[webapp]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=82</guid>
		<description><![CDATA[This week I have been working on a website for iPhone phones and I have discovered some interesting things about events. I am using plain Javascript, with no third party libraries, so I don&#8217;t know if they have any fix for these issues or if they affect them. For example, a couple of days ago [...]]]></description>
			<content:encoded><![CDATA[<p>This week I have been working on a website for iPhone phones and I have discovered some interesting things about events. I am using plain Javascript, with no third party libraries, so I don&#8217;t know if they have any fix for these issues or if they affect them.</p>
<p>For example, a couple of days ago I was posting <a href="http://dev.enekoalonso.com/2008/12/02/detecting-iphones-orientation/">how to detect the iPhone&#8217;s orientation</a>. The problem with the method I used is that I am assigning explicitly the function to handle the event, which means only that function will handle the event. If I wanted to add a second function to handle the same event, for example inside an object, I would have to use the window.addEventListener method. But apparently <strong>addEventListener does not work on the iPhone for some events</strong>.</p>
<p>The following code wont work on the iPhone (although it works on the iPhone simulator)</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">function</span> updateLayout<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>window.<span class="me1">orientation</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; document.<span class="me1">body</span>.<span class="me1">setAttribute</span><span class="br0">&#40;</span><span class="st0">&#39;class&#39;</span>, <span class="st0">&#39;landscape&#39;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">else</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; document.<span class="me1">body</span>.<span class="me1">setAttribute</span><span class="br0">&#40;</span><span class="st0">&#39;class&#39;</span>, <span class="st0">&#39;portrait&#39;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">window.<span class="me1">addEventListener</span><span class="br0">&#40;</span><span class="st0">&#39;orientationchange&#39;</span>, <span class="kw2">function</span><span class="br0">&#40;</span>event<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; updateLayout<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span>, <span class="kw2">false</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">window.<span class="me1">addEventListener</span><span class="br0">&#40;</span><span class="st0">&#39;load&#39;</span>, <span class="kw2">function</span><span class="br0">&#40;</span>event<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; updateLayout<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span>, <span class="kw2">false</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>I have found the addEventListener function works with input fields (focus and blur events), with links (click event) and with window (load event). I have found it doesn&#8217;t work on forms (submit event) neither with the custom onorientationchange event as shown avobe. I haven&#8217;t tested other events yet.</p>
<p>It may be that all these issues have been fixed in newer versions of the iPhone OS X &#8211; the one I have for testing is 1.1.4 (4A102).</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>July 30, 2010 -- <a href="http://dev.enekoalonso.com/2010/07/30/titanium-developer-love-and-hate/" title="Titanium Developer: love and hate">Titanium Developer: love and hate</a> (2)</li><li>March 24, 2010 -- <a href="http://dev.enekoalonso.com/2010/03/24/mooml-1-1-no-more-eval-say-hi-to-mooml-template-and-mooml-templates/" title="Mooml 1.1 &#8211; No more eval(), say Hi to Mooml.Template and Mooml.Templates">Mooml 1.1 &#8211; No more eval(), say Hi to Mooml.Template and Mooml.Templates</a> (0)</li><li>January 28, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/28/things-to-do/" title="Things to do">Things to do</a> (0)</li><li>September 2, 2009 -- <a href="http://dev.enekoalonso.com/2009/09/02/creating-html-blocks-with-mootools/" title="Creating HTML blocks with Mootools">Creating HTML blocks with Mootools</a> (3)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2008/12/05/handling-events-on-iphone-webapps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Detecting iPhone&#8217;s orientation</title>
		<link>http://dev.enekoalonso.com/2008/12/02/detecting-iphones-orientation/</link>
		<comments>http://dev.enekoalonso.com/2008/12/02/detecting-iphones-orientation/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 16:59:23 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[landscape]]></category>
		<category><![CDATA[orientation]]></category>
		<category><![CDATA[portrait]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=70</guid>
		<description><![CDATA[Detecting the iPhone&#8217;s orientation on a website is very easy: the only thing needed is a little bit of Javascript to listen to the onorientationchange event: window.onorientationchange = function&#40;&#41; &#123; &#160; if &#40;window.orientation&#41; &#160; &#160; document.body.setAttribute&#40;&#39;class&#39;, &#39;landscape&#39;&#41;; &#160; else &#160; &#160; document.body.setAttribute&#40;&#39;class&#39;, &#39;portrait&#39;&#41;; &#125; window.onload = function&#40;&#41; &#123; &#160; window.onorientationchange&#40;&#41;; &#125; The window.orientation variable can [...]]]></description>
			<content:encoded><![CDATA[<p>Detecting the iPhone&#8217;s orientation on a website is very easy: the only thing needed is a little bit of Javascript to listen to the <code>onorientationchange</code> event: </p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1">window.<span class="me1">onorientationchange</span> = <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>window.<span class="me1">orientation</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; document.<span class="me1">body</span>.<span class="me1">setAttribute</span><span class="br0">&#40;</span><span class="st0">&#39;class&#39;</span>, <span class="st0">&#39;landscape&#39;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">else</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; document.<span class="me1">body</span>.<span class="me1">setAttribute</span><span class="br0">&#40;</span><span class="st0">&#39;class&#39;</span>, <span class="st0">&#39;portrait&#39;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">window.<span class="kw3">onload</span> = <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; window.<span class="me1">onorientationchange</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>The <code>window.orientation</code> variable can have three different values: 0, 90 and -90. In most cases we wont mind if its 90 or -90, since both are landscape, so I have ignored this on the code above. Adding a CSS class to the body is the cleanest way to handle iPhone&#8217;s orientation. Now it&#8217;s up to you to set up the CSS for both layouts.</p>
<p>The resolution of the visible screen (viewport) changes drastically from portrait to layout, so be aware of this:</p>
<ul>
<li>Portrait visible screen: 320 x 356 px</li>
<li>Landscape visible screen: 480 x 196 px</li>
</ul>
<p>Source: <a href="https://developer.apple.com/webapps/docs/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/chapter_7_section_9.html">Web Apps Reference Library &#8211; Handling Orientation Events</a> (needs registration)</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>July 30, 2010 -- <a href="http://dev.enekoalonso.com/2010/07/30/titanium-developer-love-and-hate/" title="Titanium Developer: love and hate">Titanium Developer: love and hate</a> (2)</li><li>January 28, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/28/things-to-do/" title="Things to do">Things to do</a> (0)</li><li>August 29, 2009 -- <a href="http://dev.enekoalonso.com/2009/08/29/spaniards-for-iphone-available-now/" title="Spaniards for iPhone available now">Spaniards for iPhone available now</a> (0)</li><li>July 26, 2009 -- <a href="http://dev.enekoalonso.com/2009/07/26/placing-a-uiactivityindicartorview-on-a-uibarbuttonitem/" title="Placing a UIActivityIndicartorView on a UIBarButtonItem">Placing a UIActivityIndicartorView on a UIBarButtonItem</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2008/12/02/detecting-iphones-orientation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
