Authored by Tracy Harton

tilesource change example

... ... @@ -5,14 +5,19 @@
#import <UIKit/UIKit.h>
#import "RMMapView.h"
#import "RMOpenCycleMapSource.h"
#import "RMOpenStreetMapSource.h"
@interface MainViewController : UIViewController <RMMapViewDelegate> {
IBOutlet RMMapView * mapView;
IBOutlet UITextView * infoTextView;
IBOutlet UISegmentedControl *mapSelectControl;
}
@property (nonatomic, retain) IBOutlet RMMapView * mapView;
@property (nonatomic, retain) IBOutlet UITextView * infoTextView;
- (IBAction) mapSelectChange;
- (void)updateInfo;
@end
... ...
... ... @@ -9,6 +9,9 @@
#import "RMMarkerManager.h"
#import "MainView.h"
#import "RMLatLong.h"
#import "RMTileSource.h"
#import "RMMapContents.h"
@implementation MainViewController
... ... @@ -38,9 +41,9 @@
anchorPoint:CGPointMake(0.5, 1.0)];
[marker setTextForegroundColor:[UIColor blueColor]];
[marker changeLabelUsingText:@"Hello"];
[markerManager addMarker:marker AtLatLong:[[mapView contents] mapCenter]];
[marker release];
}
... ... @@ -83,6 +86,18 @@
truescaleDenominator]];
}
- (IBAction) mapSelectChange
{
id <RMTileSource> tileSource;
if(mapSelectControl.selectedSegmentIndex == 1)
tileSource = [[[RMOpenCycleMapSource alloc] init] autorelease];
else
tileSource = [[[RMOpenStreetMapSource alloc] init] autorelease];
[[mapView contents] setTileSource:tileSource];
}
#pragma mark -
#pragma mark Delegate methods
... ...
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.03">
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">528</int>
<string key="IBDocument.SystemVersion">9G55</string>
<string key="IBDocument.InterfaceBuilderVersion">677</string>
<string key="IBDocument.AppKitVersion">949.43</string>
<string key="IBDocument.HIToolboxVersion">353.00</string>
<string key="IBDocument.SystemVersion">10C540</string>
<string key="IBDocument.InterfaceBuilderVersion">740</string>
<string key="IBDocument.AppKitVersion">1038.25</string>
<string key="IBDocument.HIToolboxVersion">458.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">62</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="37"/>
<integer value="49"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
... ... @@ -16,7 +20,7 @@
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
... ... @@ -82,6 +86,42 @@ ZAo</string>
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
<object class="IBUITextInputTraits" key="IBUITextInputTraits"/>
</object>
<object class="IBUISegmentedControl" id="171590242">
<reference key="NSNextResponder" ref="79822186"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{56, 20}, {207, 44}}</string>
<reference key="NSSuperview" ref="79822186"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<int key="IBNumberOfSegments">2</int>
<int key="IBSelectedSegmentIndex">0</int>
<object class="NSArray" key="IBSegmentTitles">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>Street</string>
<string>Cycle</string>
</object>
<object class="NSMutableArray" key="IBSegmentWidths">
<bool key="EncodedWithXMLCoder">YES</bool>
<real value="0.0"/>
<real value="0.0"/>
</object>
<object class="NSMutableArray" key="IBSegmentEnabledStates">
<bool key="EncodedWithXMLCoder">YES</bool>
<boolean value="YES"/>
<boolean value="YES"/>
</object>
<object class="NSMutableArray" key="IBSegmentContentOffsets">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>{0, 0}</string>
<string>{0, 0}</string>
</object>
<object class="NSMutableArray" key="IBSegmentImages">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSNull" id="4"/>
<reference ref="4"/>
</object>
</object>
</object>
<string key="NSFrameSize">{320, 460}</string>
... ... @@ -134,28 +174,43 @@ ZAo</string>
</object>
<int key="connectionID">46</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">mapSelectChange</string>
<reference key="source" ref="171590242"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">13</int>
</object>
<int key="connectionID">53</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">mapSelectControl</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="171590242"/>
</object>
<int key="connectionID">54</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<object class="NSArray" key="object" id="360949347">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="object" ref="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="360949347"/>
<string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="815241450"/>
<reference key="parent" ref="360949347"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">37</int>
... ... @@ -164,7 +219,7 @@ ZAo</string>
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="79822186"/>
</object>
<reference key="parent" ref="360949347"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">39</int>
... ... @@ -172,6 +227,7 @@ ZAo</string>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="922595057"/>
<reference ref="171590242"/>
</object>
<reference key="parent" ref="702763708"/>
</object>
... ... @@ -180,11 +236,16 @@ ZAo</string>
<reference key="object" ref="922595057"/>
<reference key="parent" ref="79822186"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">49</int>
<reference key="object" ref="171590242"/>
<reference key="parent" ref="79822186"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="dict.sortedKeys">
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-2.CustomClassName</string>
... ... @@ -193,23 +254,23 @@ ZAo</string>
<string>39.CustomClassName</string>
<string>39.IBPluginDependency</string>
<string>44.IBPluginDependency</string>
<string>49.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>MainViewController</string>
<string>UIResponder</string>
<string>{{741, 489}, {320, 460}}</string>
<string>{{1129, 497}, {320, 460}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>RMMapView</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
... ... @@ -217,15 +278,13 @@ ZAo</string>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">46</int>
<int key="maxID">54</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
... ... @@ -233,16 +292,22 @@ ZAo</string>
<object class="IBPartialClassDescription">
<string key="className">MainViewController</string>
<string key="superclassName">UIViewController</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">mapSelectChange</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="dict.sortedKeys">
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>infoTextView</string>
<string>mapSelectControl</string>
<string>mapView</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UITextView</string>
<string>UISegmentedControl</string>
<string>RMMapView</string>
</object>
</object>
... ... @@ -254,7 +319,21 @@ ZAo</string>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.LastKnownRelativeProjectPath">MapTestbed.xcodeproj</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<integer value="528" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<integer value="544" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<string key="IBDocument.LastKnownRelativeProjectPath">MapTestbedFlipMaps.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">3.1</string>
</data>
</archive>
... ...