Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
1,675 additions
and
1 deletion.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>${PRODUCT_NAME}</string> | ||
<key>CFBundleExecutable</key> | ||
<string>${EXECUTABLE_NAME}</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.neilang.${PRODUCT_NAME:rfc1034identifier}</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>${PRODUCT_NAME}</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>1.0</string> | ||
<key>LSRequiresIPhoneOS</key> | ||
<true/> | ||
<key>UIRequiredDeviceCapabilities</key> | ||
<array> | ||
<string>armv7</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// Prefix header for all source files of the 'Demo' target in the 'Demo' project | ||
// | ||
|
||
#import <Availability.h> | ||
|
||
#ifndef __IPHONE_4_0 | ||
#warning "This project uses features only available in iOS SDK 4.0 and later." | ||
#endif | ||
|
||
#ifdef __OBJC__ | ||
#import <UIKit/UIKit.h> | ||
#import <Foundation/Foundation.h> | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// NAAnimatedDemoViewController.h | ||
// Demo | ||
// | ||
// Created by Neil Ang on 6/05/12. | ||
// Copyright (c) 2012 neilang.com. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface NAAnimatedDemoViewController : UIViewController | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// NAAnimatedDemoViewController.m | ||
// Demo | ||
// | ||
// Created by Neil Ang on 6/05/12. | ||
// Copyright (c) 2012 neilang.com. All rights reserved. | ||
// | ||
|
||
#import "NAAnimatedDemoViewController.h" | ||
#import "NAMapView.h" | ||
#import "NAAnnotation.h" | ||
|
||
|
||
|
||
@implementation NAAnimatedDemoViewController | ||
|
||
|
||
- (void)viewDidLoad | ||
{ | ||
[super viewDidLoad]; | ||
|
||
NAMapView *mapView = [[NAMapView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.view.frame), CGRectGetHeight(self.view.frame)-44.0f)]; | ||
|
||
mapView.backgroundColor = [UIColor colorWithRed:0.000 green:0.475 blue:0.761 alpha:1.000]; | ||
|
||
[mapView displayMap:[UIImage imageNamed:@"australia"]]; | ||
|
||
mapView.minimumZoomScale = 0.5; | ||
mapView.maximumZoomScale = 1.5; | ||
|
||
[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)]; | ||
|
||
NSArray *annotations = [NSArray arrayWithObjects:a0, a1, a2, a3, a4, a5, a6, a7, nil]; | ||
|
||
[mapView addAnnotations:annotations animated:YES]; | ||
|
||
} | ||
|
||
|
||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// NAAppDelegate.h | ||
// Demo | ||
// | ||
// Created by Neil Ang on 6/05/12. | ||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface NAAppDelegate : UIResponder <UIApplicationDelegate> | ||
|
||
@property (strong, nonatomic) UIWindow *window; | ||
|
||
@property (strong, nonatomic) UINavigationController *navigationController; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// | ||
// NAAppDelegate.m | ||
// Demo | ||
// | ||
// Created by Neil Ang on 6/05/12. | ||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import "NAAppDelegate.h" | ||
|
||
#import "NAMasterViewController.h" | ||
|
||
@implementation NAAppDelegate | ||
|
||
@synthesize window = _window; | ||
@synthesize navigationController = _navigationController; | ||
|
||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | ||
{ | ||
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | ||
// Override point for customization after application launch. | ||
|
||
NAMasterViewController *masterViewController = [[NAMasterViewController alloc] initWithNibName:@"NAMasterViewController" bundle:nil]; | ||
self.navigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController]; | ||
self.window.rootViewController = self.navigationController; | ||
[self.window makeKeyAndVisible]; | ||
return YES; | ||
} | ||
|
||
- (void)applicationWillResignActive:(UIApplication *)application | ||
{ | ||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. | ||
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. | ||
} | ||
|
||
- (void)applicationDidEnterBackground:(UIApplication *)application | ||
{ | ||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. | ||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. | ||
} | ||
|
||
- (void)applicationWillEnterForeground:(UIApplication *)application | ||
{ | ||
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. | ||
} | ||
|
||
- (void)applicationDidBecomeActive:(UIApplication *)application | ||
{ | ||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. | ||
} | ||
|
||
- (void)applicationWillTerminate:(UIApplication *)application | ||
{ | ||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// NABasicDemoViewController.h | ||
// Demo | ||
// | ||
// Created by Neil Ang on 6/05/12. | ||
// Copyright (c) 2012 neilang.com. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface NABasicDemoViewController : UIViewController | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// | ||
// NABasicDemoViewController.m | ||
// Demo | ||
// | ||
// Created by Neil Ang on 6/05/12. | ||
// Copyright (c) 2012 neilang.com. All rights reserved. | ||
// | ||
|
||
#import "NABasicDemoViewController.h" | ||
#import "NAMapView.h" | ||
#import "NAAnnotation.h" | ||
|
||
@interface NABasicDemoViewController () | ||
|
||
@end | ||
|
||
@implementation NABasicDemoViewController | ||
|
||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil | ||
{ | ||
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; | ||
if (self) { | ||
// Custom initialization | ||
} | ||
return self; | ||
} | ||
|
||
- (void)viewDidLoad | ||
{ | ||
[super viewDidLoad]; | ||
|
||
NAMapView *mapView = [[NAMapView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.view.frame), CGRectGetHeight(self.view.frame)-44.0f)]; | ||
|
||
mapView.backgroundColor = [UIColor colorWithRed:0.000 green:0.475 blue:0.761 alpha:1.000]; | ||
|
||
|
||
mapView.minimumZoomScale = 0.5; | ||
mapView.maximumZoomScale = 1.5; | ||
|
||
[mapView displayMap:[UIImage imageNamed:@"australia"]]; | ||
|
||
[self.view addSubview:mapView]; | ||
|
||
NAAnnotation *melbourne = [NAAnnotation annotationWithPoint:CGPointMake(543, 489)]; | ||
melbourne.title = @"Melbourne"; | ||
melbourne.subtitle = @"I have a subtitle"; | ||
melbourne.color = NAPinColorGreen; | ||
|
||
[mapView addAnnotation:melbourne animated:NO]; | ||
|
||
NAAnnotation * perth = [NAAnnotation annotationWithPoint:CGPointMake(63, 379)]; | ||
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)]; | ||
brisbane.title = @"Brisbane"; | ||
brisbane.color = NAPinColorPurple; | ||
|
||
[mapView addAnnotation:brisbane animated:NO]; | ||
|
||
} | ||
|
||
- (void)viewDidUnload | ||
{ | ||
[super viewDidUnload]; | ||
// Release any retained subviews of the main view. | ||
} | ||
|
||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation | ||
{ | ||
return (interfaceOrientation == UIInterfaceOrientationPortrait); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// NAInteractiveDemoViewController.h | ||
// Demo | ||
// | ||
// Created by Neil Ang on 6/05/12. | ||
// Copyright (c) 2012 neilang.com. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
#import "NAMapView.h" | ||
|
||
@interface NAInteractiveDemoViewController : UIViewController | ||
|
||
@property (nonatomic, weak) IBOutlet NAMapView *mapView; | ||
|
||
-(IBAction)addPin:(id)sender; | ||
-(IBAction)removePin:(id)sender; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// | ||
// NAInteractiveDemoViewController.m | ||
// Demo | ||
// | ||
// Created by Neil Ang on 6/05/12. | ||
// Copyright (c) 2012 neilang.com. All rights reserved. | ||
// | ||
|
||
#import "NAInteractiveDemoViewController.h" | ||
|
||
@interface NAInteractiveDemoViewController () | ||
@property (nonatomic, strong) NSMutableArray *annotations; | ||
@property (nonatomic, assign) CGSize size; | ||
@end | ||
|
||
@implementation NAInteractiveDemoViewController | ||
|
||
@synthesize mapView = _mapView; | ||
@synthesize annotations = _annotations; | ||
@synthesize size = _size; | ||
|
||
- (void)viewDidLoad | ||
{ | ||
[super viewDidLoad]; | ||
|
||
self.annotations = [[NSMutableArray alloc] init]; | ||
|
||
UIImage *image = [UIImage imageNamed:@"australia"]; | ||
|
||
self.mapView.backgroundColor = [UIColor colorWithRed:0.000 green:0.475 blue:0.761 alpha:1.000]; | ||
|
||
[self.mapView displayMap:image]; | ||
|
||
self.size = image.size; | ||
} | ||
|
||
|
||
-(IBAction)addPin:(id)sender{ | ||
|
||
int x = (arc4random() % (int)self.size.width); | ||
int y = (arc4random() % (int)self.size.width); | ||
|
||
CGPoint point = CGPointMake(x, y); | ||
|
||
[self.mapView centreOnPoint:point animated:YES]; | ||
|
||
NAAnnotation *annotation = [NAAnnotation annotationWithPoint:point]; | ||
|
||
annotation.color = arc4random() % 3; | ||
|
||
[self.mapView addAnnotation:annotation animated:YES]; | ||
|
||
[self.annotations addObject:annotation]; | ||
|
||
} | ||
|
||
-(IBAction)removePin:(id)sender{ | ||
|
||
if([self.annotations count] <= 0) return; | ||
|
||
int rand = (arc4random() % (int)[self.annotations count]); | ||
|
||
NAAnnotation *annotation = [self.annotations objectAtIndex:rand]; | ||
[self.annotations removeObjectAtIndex:rand]; | ||
|
||
[self.mapView centreOnPoint:annotation.point animated:YES]; | ||
|
||
[self.mapView removeAnnotation:annotation]; | ||
|
||
} | ||
|
||
@end |
Oops, something went wrong.