Permalink
Browse files

Updated readme and cleaned up some code

  • Loading branch information...
neilang committed Sep 24, 2012
1 parent 4500a2b commit 2bf6c3a5896025f1a7f22cae8263a5ec120a0a8f
View
@@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
- <string>${PRODUCT_NAME}</string>
+ <string>NAMapKit</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
@@ -19,25 +19,27 @@ - (void)viewDidLoad
{
[super viewDidLoad];
- NAMapView *mapView = [[NAMapView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.view.frame), CGRectGetHeight(self.view.frame)-44.0f)];
+ NAMapView *mapView = [[NAMapView alloc] initWithFrame:self.view.bounds];
- mapView.backgroundColor = [UIColor colorWithRed:0.000 green:0.475 blue:0.761 alpha:1.000];
+ mapView.backgroundColor = [UIColor colorWithRed:0.000f green:0.475f blue:0.761f alpha:1.000f];
+ mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+
[mapView displayMap:[UIImage imageNamed:@"australia"]];
- mapView.minimumZoomScale = 0.5;
- mapView.maximumZoomScale = 1.5;
+ mapView.minimumZoomScale = 0.5f;
+ mapView.maximumZoomScale = 1.5f;
[self.view addSubview:mapView];
- NAAnnotation *a0 = [NAAnnotation annotationWithPoint:CGPointMake(63, 379)];
- NAAnnotation *a1 = [NAAnnotation annotationWithPoint:CGPointMake(130, 340)];
- NAAnnotation *a2 = [NAAnnotation annotationWithPoint:CGPointMake(200, 311)];
- NAAnnotation *a3 = [NAAnnotation annotationWithPoint:CGPointMake(308, 304)];
- NAAnnotation *a4 = [NAAnnotation annotationWithPoint:CGPointMake(404, 302)];
- NAAnnotation *a5 = [NAAnnotation annotationWithPoint:CGPointMake(472, 367)];
- NAAnnotation *a6 = [NAAnnotation annotationWithPoint:CGPointMake(530, 422)];
- NAAnnotation *a7 = [NAAnnotation annotationWithPoint:CGPointMake(541, 488)];
+ NAAnnotation *a0 = [NAAnnotation annotationWithPoint:CGPointMake(63.0f, 379.0f)];
+ NAAnnotation *a1 = [NAAnnotation annotationWithPoint:CGPointMake(130.0f, 340.0f)];
+ NAAnnotation *a2 = [NAAnnotation annotationWithPoint:CGPointMake(200.0f, 311.0f)];
+ NAAnnotation *a3 = [NAAnnotation annotationWithPoint:CGPointMake(308.0f, 304.0f)];
+ NAAnnotation *a4 = [NAAnnotation annotationWithPoint:CGPointMake(404.0f, 302.0f)];
+ NAAnnotation *a5 = [NAAnnotation annotationWithPoint:CGPointMake(472.0f, 367.0f)];
+ NAAnnotation *a6 = [NAAnnotation annotationWithPoint:CGPointMake(530.0f, 422.0f)];
+ NAAnnotation *a7 = [NAAnnotation annotationWithPoint:CGPointMake(541.0f, 488.0f)];
NSArray *annotations = [NSArray arrayWithObjects:a0, a1, a2, a3, a4, a5, a6, a7, nil];
@@ -29,39 +29,40 @@ - (void)viewDidLoad
{
[super viewDidLoad];
- NAMapView *mapView = [[NAMapView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.view.frame), CGRectGetHeight(self.view.frame)-44.0f)];
+ NAMapView *mapView = [[NAMapView alloc] initWithFrame:self.view.bounds];
- mapView.backgroundColor = [UIColor colorWithRed:0.000 green:0.475 blue:0.761 alpha:1.000];
-
+ mapView.backgroundColor = [UIColor colorWithRed:0.000f green:0.475f blue:0.761f alpha:1.000f];
+ mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
- mapView.minimumZoomScale = 0.5;
- mapView.maximumZoomScale = 1.5;
+ mapView.minimumZoomScale = 0.5f;
+ mapView.maximumZoomScale = 1.5f;
[mapView displayMap:[UIImage imageNamed:@"australia"]];
[self.view addSubview:mapView];
- NAAnnotation *melbourne = [NAAnnotation annotationWithPoint:CGPointMake(543, 489)];
+ NAAnnotation *melbourne = [NAAnnotation annotationWithPoint:CGPointMake(543.0f, 489.0f)];
melbourne.title = @"Melbourne";
melbourne.subtitle = @"I have a subtitle";
melbourne.color = NAPinColorGreen;
[mapView addAnnotation:melbourne animated:NO];
- NAAnnotation * perth = [NAAnnotation annotationWithPoint:CGPointMake(63, 379)];
+ NAAnnotation * perth = [NAAnnotation annotationWithPoint:CGPointMake(63.0f, 379.0f)];
perth.title = @"Perth";
perth.subtitle = @"I have a button";
perth.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
perth.color = NAPinColorRed;
[mapView addAnnotation:perth animated:YES];
- NAAnnotation * brisbane = [NAAnnotation annotationWithPoint:CGPointMake(679, 302)];
+ NAAnnotation * brisbane = [NAAnnotation annotationWithPoint:CGPointMake(679.0f, 302.0f)];
brisbane.title = @"Brisbane";
brisbane.color = NAPinColorPurple;
[mapView addAnnotation:brisbane animated:NO];
+
}
- (void)viewDidUnload
@@ -27,7 +27,7 @@ - (void)viewDidLoad
UIImage *image = [UIImage imageNamed:@"australia"];
- self.mapView.backgroundColor = [UIColor colorWithRed:0.000 green:0.475 blue:0.761 alpha:1.000];
+ self.mapView.backgroundColor = [UIColor colorWithRed:0.000f green:0.475f blue:0.761f alpha:1.000f];
[self.mapView displayMap:image];
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
- <int key="IBDocument.SystemTarget">1296</int>
- <string key="IBDocument.SystemVersion">11D50</string>
- <string key="IBDocument.InterfaceBuilderVersion">2182</string>
- <string key="IBDocument.AppKitVersion">1138.32</string>
- <string key="IBDocument.HIToolboxVersion">568.00</string>
+ <int key="IBDocument.SystemTarget">1536</int>
+ <string key="IBDocument.SystemVersion">12C54</string>
+ <string key="IBDocument.InterfaceBuilderVersion">2840</string>
+ <string key="IBDocument.AppKitVersion">1187.34</string>
+ <string key="IBDocument.HIToolboxVersion">625.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="NS.object.0">1181</string>
+ <string key="NS.object.0">1926</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
+ <string>IBProxyObject</string>
<string>IBUIButton</string>
- <string>IBUIView</string>
<string>IBUIScrollView</string>
- <string>IBProxyObject</string>
+ <string>IBUIView</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@@ -52,7 +52,7 @@
</object>
<object class="IBUIButton" id="526644409">
<reference key="NSNextResponder" ref="191373211"/>
- <int key="NSvFlags">292</int>
+ <int key="NSvFlags">270</int>
<string key="NSFrame">{{16, 359}, {132, 37}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
@@ -88,7 +88,7 @@
</object>
<object class="IBUIButton" id="989997088">
<reference key="NSNextResponder" ref="191373211"/>
- <int key="NSvFlags">292</int>
+ <int key="NSvFlags">267</int>
<string key="NSFrame">{{168, 359}, {132, 37}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
@@ -287,10 +287,10 @@
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
- <real value="1296" key="NS.object.0"/>
+ <real value="1536" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
- <string key="IBCocoaTouchPluginVersion">1181</string>
+ <string key="IBCocoaTouchPluginVersion">1926</string>
</data>
</archive>
@@ -27,24 +27,24 @@ - (void)viewDidLoad
[self.mapView displayMap:[UIImage imageNamed:@"australia"]];
- self.mapView.backgroundColor = [UIColor colorWithRed:0.000 green:0.475 blue:0.761 alpha:1.000];
+ self.mapView.backgroundColor = [UIColor colorWithRed:0.000f green:0.475f blue:0.761f alpha:1.000f];
- NAAnnotation *melbourne = [NAAnnotation annotationWithPoint:CGPointMake(543, 489)];
+ NAAnnotation *melbourne = [NAAnnotation annotationWithPoint:CGPointMake(543.0f, 489.0f)];
melbourne.title = @"Melbourne";
melbourne.subtitle = @"I have a subtitle";
melbourne.color = NAPinColorGreen;
[self.mapView addAnnotation:melbourne animated:NO];
- NAAnnotation * perth = [NAAnnotation annotationWithPoint:CGPointMake(63, 379)];
+ NAAnnotation * perth = [NAAnnotation annotationWithPoint:CGPointMake(63.0f, 379.0f)];
perth.title = @"Perth";
perth.subtitle = @"I have a button";
perth.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
perth.color = NAPinColorRed;
[self.mapView addAnnotation:perth animated:NO];
- NAAnnotation * brisbane = [NAAnnotation annotationWithPoint:CGPointMake(679, 302)];
+ NAAnnotation * brisbane = [NAAnnotation annotationWithPoint:CGPointMake(679.0f, 302.0f)];
brisbane.title = @"Brisbane";
brisbane.color = NAPinColorPurple;
View
@@ -8,22 +8,22 @@
#import "NACallOutView.h"
-#define NA_TITLE_STANDALONE_LABEL_HEIGHT 22.0f
-#define NA_TITLE_STANDALONE_FONT_SIZE 18.0f
-#define NA_TITLE_STANDALONE_TOP_OFFSET 14.0
-#define NA_TITLE_TOP_OFFSET 4.0
-#define NA_TITLE_LABEL_HEIGHT 20.0
-#define NA_TITLE_FONT_SIZE 17.0
-#define NA_SUBTITLE_TOP_OFFSET 0.0 + NA_TITLE_LABEL_HEIGHT
-#define NA_SUBTITLE_FONT_SIZE 11.0
-#define NA_SUBTITLE_LABEL_HEIGHT 25.0
-#define NA_RIGHT_ACCESSORY_LEFT_OFFSET 2.0
-#define NA_RIGHT_ACCESSORY_TOP_OFFSET 9.0
-#define NA_ANCHOR_Y_OFFSET 26.0
-#define NA_CALLOUT_IMAGE_LEFT @"callout_left.png"
-#define NA_CALLOUT_IMAGE_RIGHT @"callout_right.png"
-#define NA_CALLOUT_IMAGE_ANCHOR @"callout_anchor.png"
-#define NA_CALLOUT_IMAGE_BG @"callout_bg.png"
+#define NA_TITLE_STANDALONE_LABEL_HEIGHT 22.0f
+#define NA_TITLE_STANDALONE_FONT_SIZE 18.0f
+#define NA_TITLE_STANDALONE_TOP_OFFSET 14.0f
+#define NA_TITLE_TOP_OFFSET 4.0f
+#define NA_TITLE_LABEL_HEIGHT 20.0f
+#define NA_TITLE_FONT_SIZE 17.0f
+#define NA_SUBTITLE_TOP_OFFSET 0.0f + NA_TITLE_LABEL_HEIGHT
+#define NA_SUBTITLE_FONT_SIZE 11.0f
+#define NA_SUBTITLE_LABEL_HEIGHT 25.0f
+#define NA_RIGHT_ACCESSORY_LEFT_OFFSET 2.0f
+#define NA_RIGHT_ACCESSORY_TOP_OFFSET 9.0f
+#define NA_ANCHOR_Y_OFFSET 26.0f
+#define NA_CALLOUT_IMAGE_LEFT @"callout_left.png"
+#define NA_CALLOUT_IMAGE_RIGHT @"callout_right.png"
+#define NA_CALLOUT_IMAGE_ANCHOR @"callout_anchor.png"
+#define NA_CALLOUT_IMAGE_BG @"callout_bg.png"
@interface NACallOutView()
View
@@ -10,16 +10,16 @@
#import "NAPinAnnotationView.h"
#import "NACallOutView.h"
-#define NA_PIN_ANIMATION_DURATION 0.5f
+#define NA_PIN_ANIMATION_DURATION 0.5f
#define NA_CALLOUT_ANIMATION_DURATION 0.1f
-#define NA_ZOOM_STEP 1.5
+#define NA_ZOOM_STEP 1.5f
@interface NAMapView()
@property (nonatomic, strong) UIImageView *imageView;
@property (nonatomic, strong) NACallOutView *calloutView;
@property (nonatomic, strong) NSMutableArray *annotationViews;
-@property (nonatomic, assign) CGSize orignalSize;
+@property (nonatomic, assign) CGSize orignalSize;
-(void)addAnimatedAnnontation:(NAAnnotation *)annontation;
-(IBAction)showCallOut:(id)sender;
@@ -8,10 +8,10 @@
#import "NAPinAnnotationView.h"
-#define NA_PIN_WIDTH 32.0f
-#define NA_PIN_HEIGHT 39.0f
-#define NA_PIN_POINT_X 8.0f
-#define NA_PIN_POINT_Y 35.0f
+#define NA_PIN_WIDTH 32.0f
+#define NA_PIN_HEIGHT 39.0f
+#define NA_PIN_POINT_X 8.0f
+#define NA_PIN_POINT_Y 35.0f
@interface NAPinAnnotationView()
@@ -50,7 +50,7 @@ - (void)setAnimating:(BOOL)animating{
case NAPinColorPurple:
pinImage = @"pinPurple";
break;
- default:
+ case NAPinColorRed:
pinImage = @"pinRed";
break;
}
View
@@ -12,7 +12,7 @@ Usage
Current version _requires ARC and iOS5_ (untested on iOS4). If you are developing for iOS3/4, checkout the version 1.0 tag of the repository.
-Example code on how to use this framework can be found in the demo app.
+Example code on how to use this framework can be found in the demo app.
If you are using Interface Builder, you can add a UIScrollView to your XIB and change the class to "NAMapView" to use the framework.
@@ -24,5 +24,5 @@ When using this code please include the following attribution:
**Includes NAMapKit code developed by [Neil Ang](http://neilang.com/) and [Tony Arnold](http://thecocoabots.com/).**
-Have an app on the AppStore that's using NAMapKit? [Add it to our showcase](https://github.com/neilang/NAMapKit/wiki/Apps-using-NAMapKit).
+Have an app on the AppStore that's using NAMapKit? [Add it to the wiki](https://github.com/neilang/NAMapKit/wiki).

0 comments on commit 2bf6c3a

Please sign in to comment.