<?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>iPhone Programming Tutorials &#187; MapKit</title>
	<atom:link href="/tag/mapkit/feed/" rel="self" type="application/rss+xml" />
	<link>http://icodeblog.com</link>
	<description>iPhone Programming Tutorials</description>
	<lastBuildDate>Tue, 19 Nov 2013 19:34:46 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1.1</generator>
	<item>
		<title>Introduction to MapKit in iPhone OS 3.0 Part 2</title>
		<link>http://icodeblog.com/2009/12/22/introduction-to-mapkit-in-iphone-os-3-0-part-2/</link>
		<comments>http://icodeblog.com/2009/12/22/introduction-to-mapkit-in-iphone-os-3-0-part-2/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 18:53:56 +0000</pubDate>
		<dc:creator><![CDATA[Collin]]></dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[Intermediate]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[MapKit]]></category>
		<category><![CDATA[MKMapView]]></category>
		<category><![CDATA[MKReverseGeocoder]]></category>
		<category><![CDATA[MKReverseGeocoderDelegate]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=1558</guid>
		<description><![CDATA[Introduction
Back in September I <a title="Introduction to MapKit in iPhone OS 3.0" href="/2009/12/21/introduction-to-mapkit-in-iphone-os-3-0/" target="_blank">posted a large post</a> going over all the components required to implement the MapKit in your application. The MapKit is a framework introduced in iPhone OS 3.0 and allows developers to easily take advantage of Google&#8217;s mapping technology. In my first post I go over how to present a map as well as annotate the map with custom badges to highlight points of interest. The MapKit also  ...]]></description>
				<content:encoded><![CDATA[<h1><span style="color: #ff6600;">Introduction</span></h1>
<p><span style="color: #000000;">Back in September I <a title="Introduction to MapKit in iPhone OS 3.0" href="/2009/12/21/introduction-to-mapkit-in-iphone-os-3-0/" target="_blank">posted a large post</a> going over all the components required to implement the MapKit in your application. The MapKit is a framework introduced in iPhone OS 3.0 and allows developers to easily take advantage of Google&#8217;s mapping technology. In my first post I go over how to present a map as well as annotate the map with custom badges to highlight points of interest. The MapKit also gives developers access to reverse geocoding services from Google which I will cover in this post.</span></p>
<h1><span style="color: #ff6600;">Reverse Geocoding</span></h1>
<p><span style="color: #000000;">A users location is defined by coordinates. When using the Core Location services, or specifying where a map should center its view, coordinates will be the units developers will be working with. This is all well and good for presenting mapping information visually but there is a whole other set of information that can be derived from a set of coordinates.</span></p>
<ul>
<li>Country</li>
<li>State</li>
<li>Zip Code</li>
<li>Address</li>
</ul>
<p>Google provides the service to translate any coordinate set to an MKPlacemark object. An MKPlacemark object contains properties to access all this information. Let&#8217;s look into the process of getting this object.</p>
<h2>Step 1</h2>
<p>The first thing you need to do is make a &#8220;View Based Application&#8221;. Now we need to is pick a set of coordinates we want to use. I have decided to use the address of Arizona State University.</p>
<p><strong>Longitude: -111.936619;</strong></p>
<p><strong>Latitude: 33.416199;</strong></p>
<p>Make your AppDelegates .m file look like this:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>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>
    <span style="color: #11740a; font-style: italic;">// Override point for customization after app launch</span>
    <span style="color: #002200;">&#91;</span>window addSubview<span style="color: #002200;">:</span>viewController.view<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>window makeKeyAndVisible<span style="color: #002200;">&#93;</span>;
&nbsp;
	CLLocationCoordinate2D coord;
	coord.longitude <span style="color: #002200;">=</span> <span style="color: #002200;">-</span><span style="color: #2400d9;">111.936619</span>;
	coord.latitude <span style="color: #002200;">=</span> <span style="color: #2400d9;">33.416199</span>;
&nbsp;
	MKReverseGeocoder <span style="color: #002200;">*</span>geocoder <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>MKReverseGeocoder alloc<span style="color: #002200;">&#93;</span> initWithCoordinate<span style="color: #002200;">:</span>coord<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>geocoder setDelegate<span style="color: #002200;">:</span>self<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>geocoder start<span style="color: #002200;">&#93;</span>
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<h2>Step 2</h2>
<p>Now we need to implement the MKReverseGeocoderDelegate methods. There are only 2 delegate methods:</p>
<p>Called when an error occurs when fetching the reverse geocoder object</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>reverseGeocoder<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>MKReverseGeocoder <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>geocoder didFailWithError<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSError</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>error</pre></td></tr></table></div>

<p>Called when the ReverseGeocode object is successfully returned.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>reverseGeocoder<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>MKReverseGeocoder <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>geocoder didFindPlacemark<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>MKPlacemark <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>placemark</pre></td></tr></table></div>

<h2>Step 3</h2>
<p>Now we have a MKPlacemark object to use. An MKPlacemark object conforms to the MKAnnotation protocol. So these objects could be added as annotations to an MKMapView. For more information on MKAnnotations reference <a title="Introduction to MapKit in iPhone OS 3.0" href="/2009/12/21/introduction-to-mapkit-in-iphone-os-3-0/">part 1</a>. The MKPlacemark object contains the following properties that you can access to use in your application.</p>
<p><a href="/wp-content/uploads/2009/12/Screen-shot-2009-12-22-at-11.48.05-AM1.png"><img class="aligncenter size-full wp-image-1563" title="Screen shot 2009-12-22 at 11.48.05 AM" src="/wp-content/uploads/2009/12/Screen-shot-2009-12-22-at-11.48.05-AM1.png" alt="" width="597" height="400" /></a></p>
<p>To see all of these values make the success delegate method look like this:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>reverseGeocoder<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>MKReverseGeocoder <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>geocoder didFindPlacemark<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>MKPlacemark <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>placemark
<span style="color: #002200;">&#123;</span>
	NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;The geocoder has returned: %@&quot;</span>, <span style="color: #002200;">&#91;</span>placemark addressDictionary<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>You should see this output:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #2400d9;">2009</span><span style="color: #002200;">-</span><span style="color: #2400d9;">12</span><span style="color: #002200;">-</span><span style="color: #2400d9;">22</span> <span style="color: #2400d9;">11</span><span style="color: #002200;">:</span><span style="color: #2400d9;">23</span><span style="color: #002200;">:</span><span style="color: #2400d9;">05.492</span> ReverseGeocoder<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">2591</span><span style="color: #002200;">:</span><span style="color: #2400d9;">207</span><span style="color: #002200;">&#93;</span> The geocoder has returned<span style="color: #002200;">:</span> <span style="color: #002200;">&#123;</span>
    City <span style="color: #002200;">=</span> Tempe;
    Country <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">&quot;United States&quot;</span>;
    CountryCode <span style="color: #002200;">=</span> US;
    FormattedAddressLines <span style="color: #002200;">=</span>     <span style="color: #002200;">&#40;</span>
        <span style="color: #bf1d1a;">&quot;200-206 E Lemon St&quot;</span>,
        <span style="color: #bf1d1a;">&quot;Tempe, AZ 85281&quot;</span>,
        USA
    <span style="color: #002200;">&#41;</span>;
    State <span style="color: #002200;">=</span> Arizona;
    Street <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">&quot;200-206 E Lemon St&quot;</span>;
    SubAdministrativeArea <span style="color: #002200;">=</span> Maricopa;
    SubThoroughfare <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">&quot;200-206&quot;</span>;
    Thoroughfare <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">&quot;E Lemon St&quot;</span>;
    ZIP <span style="color: #002200;">=</span> <span style="color: #2400d9;">85281</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/12/22/introduction-to-mapkit-in-iphone-os-3-0-part-2/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Introduction to MapKit in iPhone OS 3.0</title>
		<link>http://icodeblog.com/2009/12/21/introduction-to-mapkit-in-iphone-os-3-0/</link>
		<comments>http://icodeblog.com/2009/12/21/introduction-to-mapkit-in-iphone-os-3-0/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 23:40:08 +0000</pubDate>
		<dc:creator><![CDATA[Collin]]></dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[Intermediate]]></category>
		<category><![CDATA[MapKit]]></category>
		<category><![CDATA[MKMapView]]></category>
		<category><![CDATA[MKMapViewDelegate]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=1297</guid>
		<description><![CDATA[Introduction
Hello everyone. Welcome to another screencast. Today we will be looking into the MapKit, a new API&#8217;s made available by Apple in the iPhone OS 3.0 release. The MapKit allows simple access to the map seen in the maps application. Using GoogleMaps as its engine the map kit allows for a developer to make their own custom map interface to fit their own application. Today we will be reviewing the MapView as well as the Map Annotations that can be  ...]]></description>
				<content:encoded><![CDATA[<h1><span style="color: #ff6600;">Introduction</span></h1>
<p><span style="color: #ff6600;"><span style="color: #000000;">Hello everyone. Welcome to another screencast. Today we will be looking into the MapKit, a new API&#8217;s made available by Apple in the iPhone OS 3.0 release. The MapKit allows simple access to the map seen in the maps application. Using GoogleMaps as its engine the map kit allows for a developer to make their own custom map interface to fit their own application. Today we will be reviewing the MapView as well as the Map Annotations that can be used to highlight points of interest in a map. We will create our own custom map app, along with custom annotations. Let&#8217;s dive in.</span></span></p>
<h2 style="font-size: 1.5em;"><span style="color: #000000;">Skill Level</span> <span style="color: #ff6600;">Intermediate</span></h2>
<p>This tutorial is one for people familiar with general Objective C development and introductory experience to the iPhone SDK. Knowledge of general Interface Builder usage and DataSource and Delegate methods are required.</p>
<h1 style="font-size: 2em;"><span style="color: #ff6600;">Screencast</span></h1>
<p>I film myself coding out the entire sample project for each post. I personally think going through the Screencast is the best way to learn. But feel free to look through the slides and text if that suites you better.</p>
<p><object width="600" height="375"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=6597568&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=ff9933&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=6597568&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=ff9933&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="600" height="375"></embed></object>
<p><a href="http://vimeo.com/6597568">Introduction to Map Kit on iPhone OS 3.0</a> from <a href="http://vimeo.com/user2008025">Collin Ruffenach</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<h1 style="font-size: 2em;"><span style="color: #ff6600;">Source</span></h1>
<h3 style="font-size: 1.17em;"><span style="font-weight: normal;"><a title="iCodeBlogMapSource" href="/wp-content/uploads/2009/09/iCodeMap1.zip">iCodeBlogMap Source</a> </span></h3>
<h1 style="font-size: 2em;"><span style="color: #ff6600;">Tutorial</span></h1>
<p><img style="display: block; margin-left: auto; margin-right: auto; border: 0px initial initial;" title="Introduction to MapKit on iPhone OS 3.001" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.00121.png" alt="Introduction to MapKit on iPhone OS 3.001" width="620" height="465" /></p>
<p><img style="display: block; margin-left: auto; margin-right: auto; border: 0px initial initial;" title="Introduction to MapKit on iPhone OS 3.002" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.00211.png" alt="Introduction to MapKit on iPhone OS 3.002" width="620" height="465" /></p>
<p><a style="text-decoration: none;" href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.00311.png"><img class="aligncenter size-full wp-image-1307" title="Introduction to MapKit on iPhone OS 3.003" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.00311.png" alt="Introduction to MapKit on iPhone OS 3.003" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.00411.png"><img class="aligncenter size-full wp-image-1308" title="Introduction to MapKit on iPhone OS 3.004" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.00411.png" alt="Introduction to MapKit on iPhone OS 3.004" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.00511.png"><img class="aligncenter size-full wp-image-1309" title="Introduction to MapKit on iPhone OS 3.005" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.00511.png" alt="Introduction to MapKit on iPhone OS 3.005" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.00611.png"><img class="aligncenter size-full wp-image-1309" title="Introduction to MapKit on iPhone OS 3.006" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.00611.png" alt="Introduction to MapKit on iPhone OS 3.006" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.00711.png"><img class="aligncenter size-full wp-image-1309" title="Introduction to MapKit on iPhone OS 3.007" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.00711.png" alt="Introduction to MapKit on iPhone OS 3.007" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0081.png"><img class="aligncenter size-full wp-image-1312" title="Introduction to MapKit on iPhone OS 3.008" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0081.png" alt="Introduction to MapKit on iPhone OS 3.008" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0091.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.009" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0091.png" alt="Introduction to MapKit on iPhone OS 3.009" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0101.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.010" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0101.png" alt="Introduction to MapKit on iPhone OS 3.010" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0111.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.011" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0111.png" alt="Introduction to MapKit on iPhone OS 3.011" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0121.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.012" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0121.png" alt="Introduction to MapKit on iPhone OS 3.012" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0131.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.013" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0131.png" alt="Introduction to MapKit on iPhone OS 3.013" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0141.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.014" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0141.png" alt="Introduction to MapKit on iPhone OS 3.014" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0151.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.015" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0151.png" alt="Introduction to MapKit on iPhone OS 3.015" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0161.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.016" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0161.png" alt="Introduction to MapKit on iPhone OS 3.016" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0171.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.017" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0171.png" alt="Introduction to MapKit on iPhone OS 3.017" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0181.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.018" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0181.png" alt="Introduction to MapKit on iPhone OS 3.018" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0191.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.019" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0191.png" alt="Introduction to MapKit on iPhone OS 3.019" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0201.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.020" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0201.png" alt="Introduction to MapKit on iPhone OS 3.020" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0211.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.021" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0211.png" alt="Introduction to MapKit on iPhone OS 3.021" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0221.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.022" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0221.png" alt="Introduction to MapKit on iPhone OS 3.022" width="620" height="465" /></a></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color: #df0001;">
<h2><span style="color: #ff6600;">iCodeBlogMapViewController.h</span></h2>

<div class="wp_syntax"><table><tr><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#import &quot;iCodeBlogAnnotation.h&quot;</span>
<span style="color: #6e371a;">#import &quot;iCodeBlogAnnotationView.h&quot;</span>
&nbsp;
<span style="color: #a61390;">@interface</span> iCodeMapViewController <span style="color: #002200;">:</span> UIViewController
<span style="color: #002200;">&#123;</span>
	IBOutlet UITableView <span style="color: #002200;">*</span>tableview;
	IBOutlet MKMapView <span style="color: #002200;">*</span>mapView;
	IBOutlet UIImageView <span style="color: #002200;">*</span>shadowImage;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> IBOutlet UITableView <span style="color: #002200;">*</span>tableview;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> IBOutlet MKMapView <span style="color: #002200;">*</span>mapView;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> IBOutlet UIImageView <span style="color: #002200;">*</span>shadowImage;
&nbsp;
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>loadOurAnnotations;
&nbsp;
<span style="color: #a61390;">@end</span></pre></td></tr></table></div>

<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0231.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.023" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0231.png" alt="Introduction to MapKit on iPhone OS 3.023" width="620" height="465" /></a></p>
<h2><span style="color: #ff6600;">iCodeBlogAnnoation.h</span></h2>

<div class="wp_syntax"><table><tr><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">typedef</span> <span style="color: #a61390;">enum</span> <span style="color: #002200;">&#123;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="code"><pre class="objc" style="font-family:monospace;">	iCodeBlogAnnotationTypeApple <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>,
	iCodeBlogAnnotationTypeEDU <span style="color: #002200;">=</span> <span style="color: #2400d9;">1</span>,
	iCodeBlogAnnotationTypeTaco <span style="color: #002200;">=</span> <span style="color: #2400d9;">2</span>
<span style="color: #002200;">&#125;</span> iCodeMapAnnotationType;
&nbsp;
<span style="color: #a61390;">@interface</span> iCodeBlogAnnotation <span style="color: #002200;">:</span> <span style="color: #400080;">NSObject</span>
<span style="color: #002200;">&#123;</span>
	CLLocationCoordinate2D coordinate;
	<span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>title;
	<span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>subtitle;
	iCodeMapAnnotationType annotationType;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic<span style="color: #002200;">&#41;</span> CLLocationCoordinate2D coordinate;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>title;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>subtitle;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic<span style="color: #002200;">&#41;</span> iCodeMapAnnotationType annotationType;
&nbsp;
<span style="color: #a61390;">@end</span></pre></td></tr></table></div>

<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0241.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.024" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0241.png" alt="Introduction to MapKit on iPhone OS 3.024" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0251.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.025" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0251.png" alt="Introduction to MapKit on iPhone OS 3.025" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0261.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.026" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0261.png" alt="Introduction to MapKit on iPhone OS 3.026" width="620" height="465" /></a></p>
<h2><span style="color: #ff6600;">iCodeBlogAnnoation.m</span></h2>

<div class="wp_syntax"><table><tr><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">@implementation</span> iCodeBlogAnnotation
&nbsp;
<span style="color: #a61390;">@synthesize</span> coordinate;
<span style="color: #a61390;">@synthesize</span> title;
<span style="color: #a61390;">@synthesize</span> subtitle;
<span style="color: #a61390;">@synthesize</span> annotationType;
&nbsp;
<span style="color: #002200;">-</span>init
<span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">return</span> self;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span>initWithCoordinate<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>CLLocationCoordinate2D<span style="color: #002200;">&#41;</span>inCoord
<span style="color: #002200;">&#123;</span>
	coordinate <span style="color: #002200;">=</span> inCoord;
	<span style="color: #a61390;">return</span> self;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #a61390;">@end</span></pre></td></tr></table></div>

<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0271.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.027" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0271.png" alt="Introduction to MapKit on iPhone OS 3.027" width="620" height="465" /></a></p>
<h2><span style="color: #ff6600;">iCodeBlogAnnoationView.h</span></h2>

<div class="wp_syntax"><table><tr><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">@interface</span> iCodeBlogAnnotationView <span style="color: #002200;">:</span> MKAnnotationView
<span style="color: #002200;">&#123;</span>
	UIImageView <span style="color: #002200;">*</span>imageView;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> UIImageView <span style="color: #002200;">*</span>imageView;
&nbsp;
<span style="color: #a61390;">@end</span></pre></td></tr></table></div>

<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0281.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.028" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0281.png" alt="Introduction to MapKit on iPhone OS 3.028" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0291.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.029" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0291.png" alt="Introduction to MapKit on iPhone OS 3.029" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0301.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.030" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0301.png" alt="Introduction to MapKit on iPhone OS 3.030" width="620" height="465" /></a></p>
<h2 style="font-size: 1.5em;"><span style="color: #ff6600;">Images to Use</span></h2>
<p><img class="alignleft size-full wp-image-1380" title="AppleMarker" src="/wp-content/uploads/2009/09/AppleMarker1.png" alt="AppleMarker" width="70" height="57" /></p>
<p><span style="color: #ff6600;"><img class="alignleft" style="display: block; margin-left: auto; margin-right: auto; border: 0px initial initial;" title="SchoolMarker" src="/wp-content/uploads/2009/09/SchoolMarker1.png" alt="SchoolMarker" width="70" height="57" /></span></p>
<p><img class="alignleft" title="TacosMarker" src="/wp-content/uploads/2009/09/TacosMarker1.png" alt="TacosMarker" width="70" height="57" /></p>
<p><span style="color: #ff6600;"> </span></p>
<p><span style="color: #ff6600;"><br />
</span></p>
<p><span style="font-size: x-large;"><span><strong><span style="font-size: small;"><span style="font-weight: normal;"><br />
</span></span></strong></span></span></p>
<h2><span style="color: #ff6600;">iCodeBlogAnnoationView.m</span></h2>

<div class="wp_syntax"><table><tr><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#import &quot;iCodeBlogAnnotationView.h&quot;</span>
&nbsp;
<span style="color: #a61390;">@implementation</span> iCodeBlogAnnotationView
&nbsp;
<span style="color: #a61390;">@synthesize</span> imageView;
&nbsp;
<span style="color: #6e371a;">#define kHeight 40</span>
<span style="color: #6e371a;">#define kWidth  37</span>
<span style="color: #6e371a;">#define kBorder 2</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>initWithAnnotation<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span> <span style="color: #002200;">&#41;</span>annotation reuseIdentifier<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>reuseIdentifier
<span style="color: #002200;">&#123;</span>
	iCodeBlogAnnotation<span style="color: #002200;">*</span> myAnnotation <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span>iCodeBlogAnnotation<span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>annotation;
&nbsp;
	<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>myAnnotation annotationType<span style="color: #002200;">&#93;</span> <span style="color: #002200;">==</span> iCodeBlogAnnotationTypeApple<span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		self <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>super initWithAnnotation<span style="color: #002200;">:</span>myAnnotation reuseIdentifier<span style="color: #002200;">:</span>reuseIdentifier<span style="color: #002200;">&#93;</span>;
		self.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0</span>, <span style="color: #2400d9;">0</span>, kWidth, kHeight<span style="color: #002200;">&#41;</span>;
		self.backgroundColor <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIColor clearColor<span style="color: #002200;">&#93;</span>;
&nbsp;
		imageView <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIImageView alloc<span style="color: #002200;">&#93;</span> initWithImage<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;AppleMarker.png&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
		imageView.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span>kBorder, kBorder, kWidth <span style="color: #002200;">-</span> <span style="color: #2400d9;">2</span> <span style="color: #002200;">*</span> kBorder, kWidth <span style="color: #002200;">-</span> <span style="color: #2400d9;">2</span> <span style="color: #002200;">*</span> kBorder<span style="color: #002200;">&#41;</span>;
		<span style="color: #002200;">&#91;</span>self addSubview<span style="color: #002200;">:</span>imageView<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#125;</span>
&nbsp;
	<span style="color: #a61390;">else</span> <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>myAnnotation annotationType<span style="color: #002200;">&#93;</span> <span style="color: #002200;">==</span> iCodeBlogAnnotationTypeEDU<span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		self <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>super initWithAnnotation<span style="color: #002200;">:</span>myAnnotation reuseIdentifier<span style="color: #002200;">:</span>reuseIdentifier<span style="color: #002200;">&#93;</span>;
		self.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0</span>, <span style="color: #2400d9;">0</span>, kWidth, kHeight<span style="color: #002200;">&#41;</span>;
		self.backgroundColor <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIColor clearColor<span style="color: #002200;">&#93;</span>;
&nbsp;
		imageView <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIImageView alloc<span style="color: #002200;">&#93;</span> initWithImage<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;SchoolMarker.png&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
		imageView.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span>kBorder, kBorder, kWidth <span style="color: #002200;">-</span> <span style="color: #2400d9;">2</span> <span style="color: #002200;">*</span> kBorder, kWidth <span style="color: #002200;">-</span> <span style="color: #2400d9;">2</span> <span style="color: #002200;">*</span> kBorder<span style="color: #002200;">&#41;</span>;
		<span style="color: #002200;">&#91;</span>self addSubview<span style="color: #002200;">:</span>imageView<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#125;</span>
&nbsp;
	<span style="color: #a61390;">else</span> <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>myAnnotation annotationType<span style="color: #002200;">&#93;</span> <span style="color: #002200;">==</span> iCodeBlogAnnotationTypeTaco<span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		self <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>super initWithAnnotation<span style="color: #002200;">:</span>myAnnotation reuseIdentifier<span style="color: #002200;">:</span>reuseIdentifier<span style="color: #002200;">&#93;</span>;
		self.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0</span>, <span style="color: #2400d9;">0</span>, kWidth, kHeight<span style="color: #002200;">&#41;</span>;
		self.backgroundColor <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIColor clearColor<span style="color: #002200;">&#93;</span>;
&nbsp;
		imageView <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIImageView alloc<span style="color: #002200;">&#93;</span> initWithImage<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;TacosMarker.png&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
		imageView.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span>kBorder, kBorder, kWidth <span style="color: #002200;">-</span> <span style="color: #2400d9;">2</span> <span style="color: #002200;">*</span> kBorder, kWidth <span style="color: #002200;">-</span> <span style="color: #2400d9;">2</span> <span style="color: #002200;">*</span> kBorder<span style="color: #002200;">&#41;</span>;
		<span style="color: #002200;">&#91;</span>self addSubview<span style="color: #002200;">:</span>imageView<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#125;</span>
&nbsp;
	<span style="color: #002200;">&#91;</span>imageView setContentMode<span style="color: #002200;">:</span>UIViewContentModeScaleAspectFill<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #a61390;">return</span> self;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #a61390;">@end</span></pre></td></tr></table></div>

<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0311.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.031" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0311.png" alt="Introduction to MapKit on iPhone OS 3.031" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0321.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.032" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0321.png" alt="Introduction to MapKit on iPhone OS 3.032" width="620" height="465" /></a></p>
<h2><span style="color: #ff6600;">iCodeBlogMapViewController.m</span></h2>

<div class="wp_syntax"><table><tr><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>loadOurAnnotations
<span style="color: #002200;">&#123;</span>
	CLLocationCoordinate2D workingCoordinate;
&nbsp;
	workingCoordinate.latitude <span style="color: #002200;">=</span> <span style="color: #2400d9;">40.763856</span>;
	workingCoordinate.longitude <span style="color: #002200;">=</span> <span style="color: #002200;">-</span><span style="color: #2400d9;">73.973034</span>;
	iCodeBlogAnnotation <span style="color: #002200;">*</span>appleStore1 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>iCodeBlogAnnotation alloc<span style="color: #002200;">&#93;</span> initWithCoordinate<span style="color: #002200;">:</span>workingCoordinate<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>appleStore1 setTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Apple Store 5th Ave.&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>appleStore1 setSubtitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Apple's Flagship Store&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>appleStore1 setAnnotationType<span style="color: #002200;">:</span>iCodeBlogAnnotationTypeApple<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #002200;">&#91;</span>mapView addAnnotation<span style="color: #002200;">:</span>appleStore1<span style="color: #002200;">&#93;</span>;
&nbsp;
	workingCoordinate.latitude <span style="color: #002200;">=</span> <span style="color: #2400d9;">51.514298</span>;
	workingCoordinate.longitude <span style="color: #002200;">=</span> <span style="color: #002200;">-</span><span style="color: #2400d9;">0.141949</span>;
	iCodeBlogAnnotation <span style="color: #002200;">*</span>appleStore2 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>iCodeBlogAnnotation alloc<span style="color: #002200;">&#93;</span> initWithCoordinate<span style="color: #002200;">:</span>workingCoordinate<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>appleStore2 setTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Apple Store St. Regent&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>appleStore2 setSubtitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;London England&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>appleStore2 setAnnotationType<span style="color: #002200;">:</span>iCodeBlogAnnotationTypeApple<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #002200;">&#91;</span>mapView addAnnotation<span style="color: #002200;">:</span>appleStore2<span style="color: #002200;">&#93;</span>;
&nbsp;
	workingCoordinate.latitude <span style="color: #002200;">=</span> <span style="color: #2400d9;">35.672284</span>;
	workingCoordinate.longitude <span style="color: #002200;">=</span> <span style="color: #2400d9;">139.765702</span>;
	iCodeBlogAnnotation <span style="color: #002200;">*</span>appleStore3 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>iCodeBlogAnnotation alloc<span style="color: #002200;">&#93;</span> initWithCoordinate<span style="color: #002200;">:</span>workingCoordinate<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>appleStore3 setTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Apple Store Giza&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>appleStore3 setSubtitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Tokyo, Japan&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>appleStore3 setAnnotationType<span style="color: #002200;">:</span>iCodeBlogAnnotationTypeApple<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #002200;">&#91;</span>mapView addAnnotation<span style="color: #002200;">:</span>appleStore3<span style="color: #002200;">&#93;</span>;
&nbsp;
	workingCoordinate.latitude <span style="color: #002200;">=</span> <span style="color: #2400d9;">37.331741</span>;
	workingCoordinate.longitude <span style="color: #002200;">=</span> <span style="color: #002200;">-</span><span style="color: #2400d9;">122.030564</span>;
	iCodeBlogAnnotation <span style="color: #002200;">*</span>appleStore4 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>iCodeBlogAnnotation alloc<span style="color: #002200;">&#93;</span> initWithCoordinate<span style="color: #002200;">:</span>workingCoordinate<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>appleStore4 setTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Apple Headquarters&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>appleStore4 setSubtitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;The Mothership&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>appleStore4 setAnnotationType<span style="color: #002200;">:</span>iCodeBlogAnnotationTypeApple<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #002200;">&#91;</span>mapView addAnnotation<span style="color: #002200;">:</span>appleStore4<span style="color: #002200;">&#93;</span>;
&nbsp;
	workingCoordinate.latitude <span style="color: #002200;">=</span> <span style="color: #2400d9;">41.894518</span>;
	workingCoordinate.longitude <span style="color: #002200;">=</span> <span style="color: #002200;">-</span><span style="color: #2400d9;">87.624005</span>;
	iCodeBlogAnnotation <span style="color: #002200;">*</span>appleStore5 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>iCodeBlogAnnotation alloc<span style="color: #002200;">&#93;</span> initWithCoordinate<span style="color: #002200;">:</span>workingCoordinate<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>appleStore5 setTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Apple Store Michigan Ave.&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>appleStore5 setSubtitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Chicago, IL&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>appleStore5 setAnnotationType<span style="color: #002200;">:</span>iCodeBlogAnnotationTypeApple<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #002200;">&#91;</span>mapView addAnnotation<span style="color: #002200;">:</span>appleStore5<span style="color: #002200;">&#93;</span>;
&nbsp;
	workingCoordinate.latitude <span style="color: #002200;">=</span> <span style="color: #2400d9;">32.264977</span>;
	workingCoordinate.longitude <span style="color: #002200;">=</span> <span style="color: #002200;">-</span><span style="color: #2400d9;">110.944011</span>;
	iCodeBlogAnnotation <span style="color: #002200;">*</span>tacoShop1 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>iCodeBlogAnnotation alloc<span style="color: #002200;">&#93;</span> initWithCoordinate<span style="color: #002200;">:</span>workingCoordinate<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>tacoShop1 setTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Nico's Taco Shop&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>tacoShop1 setSubtitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Tucson, AZ&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>tacoShop1 setAnnotationType<span style="color: #002200;">:</span>iCodeBlogAnnotationTypeTaco<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #002200;">&#91;</span>mapView addAnnotation<span style="color: #002200;">:</span>tacoShop1<span style="color: #002200;">&#93;</span>;
&nbsp;
	workingCoordinate.latitude <span style="color: #002200;">=</span> <span style="color: #2400d9;">32.743242</span>;
	workingCoordinate.longitude <span style="color: #002200;">=</span> <span style="color: #002200;">-</span><span style="color: #2400d9;">117.181451</span>;
	iCodeBlogAnnotation <span style="color: #002200;">*</span>tacoShop2 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>iCodeBlogAnnotation alloc<span style="color: #002200;">&#93;</span> initWithCoordinate<span style="color: #002200;">:</span>workingCoordinate<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>tacoShop2 setTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Lucha Libre Gourmet&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>tacoShop2 setSubtitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;San Diego, CA&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>tacoShop2 setAnnotationType<span style="color: #002200;">:</span>iCodeBlogAnnotationTypeTaco<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #002200;">&#91;</span>mapView addAnnotation<span style="color: #002200;">:</span>tacoShop2<span style="color: #002200;">&#93;</span>;
&nbsp;
	workingCoordinate.latitude <span style="color: #002200;">=</span> <span style="color: #2400d9;">32.594987</span>;
	workingCoordinate.longitude <span style="color: #002200;">=</span> <span style="color: #002200;">-</span><span style="color: #2400d9;">117.060936</span>;
	iCodeBlogAnnotation <span style="color: #002200;">*</span>tacoShop3 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>iCodeBlogAnnotation alloc<span style="color: #002200;">&#93;</span> initWithCoordinate<span style="color: #002200;">:</span>workingCoordinate<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>tacoShop3 setTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;El Ranchero Taco Shop&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>tacoShop3 setSubtitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Rocky Pointe, Mexico&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>tacoShop3 setAnnotationType<span style="color: #002200;">:</span>iCodeBlogAnnotationTypeTaco<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #002200;">&#91;</span>mapView addAnnotation<span style="color: #002200;">:</span>tacoShop3<span style="color: #002200;">&#93;</span>;
&nbsp;
	workingCoordinate.latitude <span style="color: #002200;">=</span> <span style="color: #002200;">-</span><span style="color: #2400d9;">34.594859</span>;
	workingCoordinate.longitude <span style="color: #002200;">=</span> <span style="color: #002200;">-</span><span style="color: #2400d9;">58.384336</span>;
	iCodeBlogAnnotation <span style="color: #002200;">*</span>tacoShop4 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>iCodeBlogAnnotation alloc<span style="color: #002200;">&#93;</span> initWithCoordinate<span style="color: #002200;">:</span>workingCoordinate<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>tacoShop4 setTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Taco Tequila Sangria S.A.&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>tacoShop4 setSubtitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Buneos Aires, Argentina&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>tacoShop4 setAnnotationType<span style="color: #002200;">:</span>iCodeBlogAnnotationTypeTaco<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #002200;">&#91;</span>mapView addAnnotation<span style="color: #002200;">:</span>tacoShop4<span style="color: #002200;">&#93;</span>;
&nbsp;
	workingCoordinate.latitude <span style="color: #002200;">=</span> <span style="color: #2400d9;">38.240550</span>;
	workingCoordinate.longitude <span style="color: #002200;">=</span> <span style="color: #002200;">-</span><span style="color: #2400d9;">0.526509</span>;
	iCodeBlogAnnotation <span style="color: #002200;">*</span>tacoShop5 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>iCodeBlogAnnotation alloc<span style="color: #002200;">&#93;</span> initWithCoordinate<span style="color: #002200;">:</span>workingCoordinate<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>tacoShop5 setTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Albertsma Taco&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>tacoShop5 setSubtitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Gran Alacant, Spain&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>tacoShop5 setAnnotationType<span style="color: #002200;">:</span>iCodeBlogAnnotationTypeTaco<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #002200;">&#91;</span>mapView addAnnotation<span style="color: #002200;">:</span>tacoShop5<span style="color: #002200;">&#93;</span>;
&nbsp;
	workingCoordinate.latitude <span style="color: #002200;">=</span> <span style="color: #2400d9;">33.419490</span>;
	workingCoordinate.longitude <span style="color: #002200;">=</span> <span style="color: #002200;">-</span><span style="color: #2400d9;">111.930563</span>;
	iCodeBlogAnnotation <span style="color: #002200;">*</span>school1 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>iCodeBlogAnnotation alloc<span style="color: #002200;">&#93;</span> initWithCoordinate<span style="color: #002200;">:</span>workingCoordinate<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>school1 setTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Arizona State University&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>school1 setSubtitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Go Sun Devils&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>school1 setAnnotationType<span style="color: #002200;">:</span>iCodeBlogAnnotationTypeEDU<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #002200;">&#91;</span>mapView addAnnotation<span style="color: #002200;">:</span>school1<span style="color: #002200;">&#93;</span>;
&nbsp;
	workingCoordinate.latitude <span style="color: #002200;">=</span> <span style="color: #2400d9;">35.087537</span>;
	workingCoordinate.longitude <span style="color: #002200;">=</span> <span style="color: #002200;">-</span><span style="color: #2400d9;">106.618184</span>;
	iCodeBlogAnnotation <span style="color: #002200;">*</span>school2 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>iCodeBlogAnnotation alloc<span style="color: #002200;">&#93;</span> initWithCoordinate<span style="color: #002200;">:</span>workingCoordinate<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>school2 setTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;University of New Mexico&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>school2 setSubtitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Go Lobos&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>school2 setAnnotationType<span style="color: #002200;">:</span>iCodeBlogAnnotationTypeEDU<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #002200;">&#91;</span>mapView addAnnotation<span style="color: #002200;">:</span>school2<span style="color: #002200;">&#93;</span>;
&nbsp;
	workingCoordinate.latitude <span style="color: #002200;">=</span> <span style="color: #2400d9;">40.730838</span>;
	workingCoordinate.longitude <span style="color: #002200;">=</span> <span style="color: #002200;">-</span><span style="color: #2400d9;">73.997498</span>;
	iCodeBlogAnnotation <span style="color: #002200;">*</span>school3 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>iCodeBlogAnnotation alloc<span style="color: #002200;">&#93;</span> initWithCoordinate<span style="color: #002200;">:</span>workingCoordinate<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>school3 setTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;New York University&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>school3 setSubtitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;New York, NY&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>school3 setAnnotationType<span style="color: #002200;">:</span>iCodeBlogAnnotationTypeEDU<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #002200;">&#91;</span>mapView addAnnotation<span style="color: #002200;">:</span>school3<span style="color: #002200;">&#93;</span>;
&nbsp;
	workingCoordinate.latitude <span style="color: #002200;">=</span> <span style="color: #2400d9;">51.753523</span>;
	workingCoordinate.longitude <span style="color: #002200;">=</span> <span style="color: #002200;">-</span><span style="color: #2400d9;">1.253171</span>;
	iCodeBlogAnnotation <span style="color: #002200;">*</span>school4 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>iCodeBlogAnnotation alloc<span style="color: #002200;">&#93;</span> initWithCoordinate<span style="color: #002200;">:</span>workingCoordinate<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>school4 setTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Oxford University&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>school4 setSubtitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Oxford, England&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>school4 setAnnotationType<span style="color: #002200;">:</span>iCodeBlogAnnotationTypeEDU<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #002200;">&#91;</span>mapView addAnnotation<span style="color: #002200;">:</span>school4<span style="color: #002200;">&#93;</span>;
&nbsp;
	workingCoordinate.latitude <span style="color: #002200;">=</span> <span style="color: #2400d9;">22.131982</span>;
	workingCoordinate.longitude <span style="color: #002200;">=</span> <span style="color: #2400d9;">82.142302</span>;
	iCodeBlogAnnotation <span style="color: #002200;">*</span>school5 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>iCodeBlogAnnotation alloc<span style="color: #002200;">&#93;</span> initWithCoordinate<span style="color: #002200;">:</span>workingCoordinate<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>school5 setTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;India Institute of Technology&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>school5 setSubtitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Delhi, India&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>school5 setAnnotationType<span style="color: #002200;">:</span>iCodeBlogAnnotationTypeEDU<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #002200;">&#91;</span>mapView addAnnotation<span style="color: #002200;">:</span>school5<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p><a style="text-decoration: none;" href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0331.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.033" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0331.png" alt="Introduction to MapKit on iPhone OS 3.033" width="620" height="465" /></a></p>
<h2><span style="color: #ff6600;">iCodeblogMapViewController.m</span></h2>

<div class="wp_syntax"><table><tr><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>iCodeBlogAnnotationView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>mapView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>MKMapView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>mapView viewForAnnotation<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span> <span style="color: #002200;">&#41;</span>annotation
<span style="color: #002200;">&#123;</span>
	iCodeBlogAnnotationView <span style="color: #002200;">*</span>annotationView <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>;
&nbsp;
	<span style="color: #11740a; font-style: italic;">// determine the type of annotation, and produce the correct type of annotation view for it.</span>
	iCodeBlogAnnotation<span style="color: #002200;">*</span> myAnnotation <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span>iCodeBlogAnnotation <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>annotation;
&nbsp;
	<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>myAnnotation.annotationType <span style="color: #002200;">==</span> iCodeBlogAnnotationTypeApple<span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		<span style="color: #400080;">NSString</span><span style="color: #002200;">*</span> identifier <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Apple&quot;</span>;
		iCodeBlogAnnotationView <span style="color: #002200;">*</span>newAnnotationView <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span>iCodeBlogAnnotationView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#91;</span>self.mapView dequeueReusableAnnotationViewWithIdentifier<span style="color: #002200;">:</span>identifier<span style="color: #002200;">&#93;</span>;
&nbsp;
		<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">nil</span> <span style="color: #002200;">==</span> newAnnotationView<span style="color: #002200;">&#41;</span>
		<span style="color: #002200;">&#123;</span>
			newAnnotationView <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>iCodeBlogAnnotationView alloc<span style="color: #002200;">&#93;</span> initWithAnnotation<span style="color: #002200;">:</span>myAnnotation reuseIdentifier<span style="color: #002200;">:</span>identifier<span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;
		<span style="color: #002200;">&#125;</span>
&nbsp;
		annotationView <span style="color: #002200;">=</span> newAnnotationView;
	<span style="color: #002200;">&#125;</span>
	<span style="color: #a61390;">else</span> <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>myAnnotation.annotationType <span style="color: #002200;">==</span> iCodeBlogAnnotationTypeEDU<span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		<span style="color: #400080;">NSString</span><span style="color: #002200;">*</span> identifier <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;School&quot;</span>;
&nbsp;
		iCodeBlogAnnotationView <span style="color: #002200;">*</span>newAnnotationView <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span>iCodeBlogAnnotationView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#91;</span>self.mapView dequeueReusableAnnotationViewWithIdentifier<span style="color: #002200;">:</span>identifier<span style="color: #002200;">&#93;</span>;
&nbsp;
		<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">nil</span> <span style="color: #002200;">==</span> newAnnotationView<span style="color: #002200;">&#41;</span>
		<span style="color: #002200;">&#123;</span>
			newAnnotationView <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>iCodeBlogAnnotationView alloc<span style="color: #002200;">&#93;</span> initWithAnnotation<span style="color: #002200;">:</span>myAnnotation reuseIdentifier<span style="color: #002200;">:</span>identifier<span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;
		<span style="color: #002200;">&#125;</span>
&nbsp;
		annotationView <span style="color: #002200;">=</span> newAnnotationView;
	<span style="color: #002200;">&#125;</span>
	<span style="color: #a61390;">else</span> <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>myAnnotation.annotationType <span style="color: #002200;">==</span> iCodeBlogAnnotationTypeTaco<span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		<span style="color: #400080;">NSString</span><span style="color: #002200;">*</span> identifier <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Taco&quot;</span>;
&nbsp;
		iCodeBlogAnnotationView <span style="color: #002200;">*</span>newAnnotationView <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span>iCodeBlogAnnotationView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#91;</span>self.mapView dequeueReusableAnnotationViewWithIdentifier<span style="color: #002200;">:</span>identifier<span style="color: #002200;">&#93;</span>;
&nbsp;
		<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">nil</span> <span style="color: #002200;">==</span> newAnnotationView<span style="color: #002200;">&#41;</span>
		<span style="color: #002200;">&#123;</span>
			newAnnotationView <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>iCodeBlogAnnotationView alloc<span style="color: #002200;">&#93;</span> initWithAnnotation<span style="color: #002200;">:</span>myAnnotation reuseIdentifier<span style="color: #002200;">:</span>identifier<span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;
		<span style="color: #002200;">&#125;</span>
&nbsp;
		annotationView <span style="color: #002200;">=</span> newAnnotationView;
	<span style="color: #002200;">&#125;</span>
&nbsp;
	<span style="color: #002200;">&#91;</span>annotationView setEnabled<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>annotationView setCanShowCallout<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #a61390;">return</span> annotationView;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0341.png"><img class="aligncenter size-full wp-image-1313" title="Introduction to MapKit on iPhone OS 3.034" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.0341.png" alt="Introduction to MapKit on iPhone OS 3.034" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.03511.png"><img class="aligncenter size-full wp-image-1349" title="Introduction to MapKit on iPhone OS 3.035" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.03511.png" alt="Introduction to MapKit on iPhone OS 3.035" width="620" height="465" /></a></p>
<h2><span style="color: #ff6600;">iCodeBlogMapViewController.m</span></h2>

<div class="wp_syntax"><table><tr><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>numberOfSectionsInTableView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITableView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView
<span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">return</span> <span style="color: #2400d9;">3</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p><a style="text-decoration: none;" href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.03611.png"><img class="aligncenter size-full wp-image-1350" title="Introduction to MapKit on iPhone OS 3.036" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.03611.png" alt="Introduction to MapKit on iPhone OS 3.036" width="620" height="465" /></a></p>
<h2><span style="color: #ff6600;">iCodeBlogMapViewController.m</span></h2>

<div class="wp_syntax"><table><tr><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITableView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView titleForHeaderInSection<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>section</pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>section <span style="color: #002200;">==</span> iCodeBlogAnnotationTypeApple<span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		<span style="color: #a61390;">return</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Apple Markers&quot;</span>;
	<span style="color: #002200;">&#125;</span>
&nbsp;
	<span style="color: #a61390;">else</span> <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>section <span style="color: #002200;">==</span> iCodeBlogAnnotationTypeEDU<span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		<span style="color: #a61390;">return</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Schools&quot;</span>;
	<span style="color: #002200;">&#125;</span>
&nbsp;
	<span style="color: #a61390;">else</span> <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>section <span style="color: #002200;">==</span> iCodeBlogAnnotationTypeTaco<span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		<span style="color: #a61390;">return</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Taco Shops&quot;</span>;
	<span style="color: #002200;">&#125;</span>
&nbsp;
	<span style="color: #a61390;">return</span> <span style="color: #a61390;">nil</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.03711.png"><img class="aligncenter size-full wp-image-1351" title="Introduction to MapKit on iPhone OS 3.037" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.03711.png" alt="Introduction to MapKit on iPhone OS 3.037" width="620" height="465" /></a><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.03811.png"></a></p>
<h2><span style="color: #ff6600;">iCodeBlogMapViewController.m</span></h2>

<div class="wp_syntax"><table><tr><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>tableView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITableView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView numberOfRowsInSection<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>section
<span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">return</span> <span style="color: #2400d9;">5</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.03811.png"><img class="aligncenter size-full wp-image-1352" title="Introduction to MapKit on iPhone OS 3.038" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.03811.png" alt="Introduction to MapKit on iPhone OS 3.038" width="620" height="465" /></a><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.03911.png"></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.03911.png"><img class="aligncenter size-full wp-image-1353" title="Introduction to MapKit on iPhone OS 3.039" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.03911.png" alt="Introduction to MapKit on iPhone OS 3.039" width="620" height="465" /></a></p>
<h2><span style="color: #ff6600;">iCodeBlogMapViewController.m</span></h2>

<div class="wp_syntax"><table><tr><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>UITableViewCell <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITableView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView cellForRowAtIndexPath<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSIndexPath</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>indexPath
<span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">static</span> <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>CellIdentifier <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Cell&quot;</span>;
&nbsp;
    UITableViewCell <span style="color: #002200;">*</span>cell <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>tableView dequeueReusableCellWithIdentifier<span style="color: #002200;">:</span>CellIdentifier<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>cell <span style="color: #002200;">==</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
        cell <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UITableViewCell alloc<span style="color: #002200;">&#93;</span> initWithStyle<span style="color: #002200;">:</span>UITableViewCellStyleDefault reuseIdentifier<span style="color: #002200;">:</span>CellIdentifier<span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#125;</span>
&nbsp;
	<span style="color: #400080;">NSMutableArray</span> <span style="color: #002200;">*</span>annotations <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSMutableArray</span> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>indexPath.section <span style="color: #002200;">==</span> <span style="color: #2400d9;">0</span><span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		<span style="color: #a61390;">for</span><span style="color: #002200;">&#40;</span>iCodeBlogAnnotation <span style="color: #002200;">*</span>annotation <span style="color: #a61390;">in</span> <span style="color: #002200;">&#91;</span>mapView annotations<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>
		<span style="color: #002200;">&#123;</span>
			<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>annotation annotationType<span style="color: #002200;">&#93;</span> <span style="color: #002200;">==</span> iCodeBlogAnnotationTypeApple<span style="color: #002200;">&#41;</span>
			<span style="color: #002200;">&#123;</span>
				<span style="color: #002200;">&#91;</span>annotations addObject<span style="color: #002200;">:</span>annotation<span style="color: #002200;">&#93;</span>;
			<span style="color: #002200;">&#125;</span>
		<span style="color: #002200;">&#125;</span>
&nbsp;
		cell.textLabel.text <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>annotations objectAtIndex<span style="color: #002200;">:</span>indexPath.row<span style="color: #002200;">&#93;</span> title<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#125;</span>
&nbsp;
	<span style="color: #a61390;">else</span> <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>indexPath.section <span style="color: #002200;">==</span> <span style="color: #2400d9;">1</span><span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		<span style="color: #a61390;">for</span><span style="color: #002200;">&#40;</span>iCodeBlogAnnotation <span style="color: #002200;">*</span>annotation <span style="color: #a61390;">in</span> <span style="color: #002200;">&#91;</span>mapView annotations<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>
		<span style="color: #002200;">&#123;</span>
			<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>annotation annotationType<span style="color: #002200;">&#93;</span> <span style="color: #002200;">==</span> iCodeBlogAnnotationTypeEDU<span style="color: #002200;">&#41;</span>
			<span style="color: #002200;">&#123;</span>
				<span style="color: #002200;">&#91;</span>annotations addObject<span style="color: #002200;">:</span>annotation<span style="color: #002200;">&#93;</span>;
			<span style="color: #002200;">&#125;</span>
		<span style="color: #002200;">&#125;</span>
&nbsp;
		cell.textLabel.text <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>annotations objectAtIndex<span style="color: #002200;">:</span>indexPath.row<span style="color: #002200;">&#93;</span> title<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#125;</span>
&nbsp;
	<span style="color: #a61390;">else</span> <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>indexPath.section <span style="color: #002200;">==</span> <span style="color: #2400d9;">2</span><span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		<span style="color: #a61390;">for</span><span style="color: #002200;">&#40;</span>iCodeBlogAnnotation <span style="color: #002200;">*</span>annotation <span style="color: #a61390;">in</span> <span style="color: #002200;">&#91;</span>mapView annotations<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>
		<span style="color: #002200;">&#123;</span>
			<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>annotation annotationType<span style="color: #002200;">&#93;</span> <span style="color: #002200;">==</span> iCodeBlogAnnotationTypeTaco<span style="color: #002200;">&#41;</span>
			<span style="color: #002200;">&#123;</span>
				<span style="color: #002200;">&#91;</span>annotations addObject<span style="color: #002200;">:</span>annotation<span style="color: #002200;">&#93;</span>;
			<span style="color: #002200;">&#125;</span>
		<span style="color: #002200;">&#125;</span>
&nbsp;
		cell.textLabel.text <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>annotations objectAtIndex<span style="color: #002200;">:</span>indexPath.row<span style="color: #002200;">&#93;</span> title<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#125;</span>
&nbsp;
    <span style="color: #a61390;">return</span> cell;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.04011.png"><img class="aligncenter size-full wp-image-1354" title="Introduction to MapKit on iPhone OS 3.040" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.04011.png" alt="Introduction to MapKit on iPhone OS 3.040" width="620" height="465" /></a></p>
<p><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.04111.png"><img class="aligncenter size-full wp-image-1355" title="Introduction to MapKit on iPhone OS 3.041" src="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.04111.png" alt="Introduction to MapKit on iPhone OS 3.041" width="620" height="465" /></a><a href="/wp-content/uploads/2009/09/Introduction-to-MapKit-on-iPhone-OS-3.00121.png"></a></p>
<h2><span style="color: #ff6600;">iCodeBlogMapViewController.m</span></h2>

<div class="wp_syntax"><table><tr><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>tableView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITableView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView didSelectRowAtIndexPath<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSIndexPath</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>indexPath
<span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">for</span><span style="color: #002200;">&#40;</span>iCodeBlogAnnotation <span style="color: #002200;">*</span>annotation <span style="color: #a61390;">in</span> <span style="color: #002200;">&#91;</span>mapView annotations<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>tableView cellForRowAtIndexPath<span style="color: #002200;">:</span>indexPath<span style="color: #002200;">&#93;</span> textLabel<span style="color: #002200;">&#93;</span> text<span style="color: #002200;">&#93;</span> isEqualToString<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>annotation title<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>
		<span style="color: #002200;">&#123;</span>
			<span style="color: #002200;">&#91;</span>mapView setRegion<span style="color: #002200;">:</span>MKCoordinateRegionMake<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>annotation coordinate<span style="color: #002200;">&#93;</span>, MKCoordinateSpanMake<span style="color: #002200;">&#40;</span>.01, .01<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span> animated<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;
		<span style="color: #002200;">&#125;</span>
	<span style="color: #002200;">&#125;</span>
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/12/21/introduction-to-mapkit-in-iphone-os-3-0/feed/</wfw:commentRss>
		<slash:comments>58</slash:comments>
		</item>
	</channel>
</rss>
