Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Modernized project. Now uses ARC. Removed TouchJSON dependency.

  • Loading branch information...
commit d0926dda0492fe1eb4e4e09fcdc2c41b0bbdee57 1 parent c960ce3
@preble authored
Showing with 229 additions and 588 deletions.
  1. +2 −3 .gitignore
  2. +0 −20 Classes/GestureView.h
  3. +0 −22 Classes/GesturesAppDelegate.h
  4. +0 −59 Classes/GesturesViewController.m
  5. 0  {Classes → GLGestureRecognizer}/GLGestureRecognizer+JSONTemplates.h
  6. +8 −12 {Classes → GLGestureRecognizer}/GLGestureRecognizer+JSONTemplates.m
  7. +8 −10 {Classes → GLGestureRecognizer}/GLGestureRecognizer.h
  8. +98 −96 {Classes → GLGestureRecognizer}/GLGestureRecognizer.m
  9. +35 −118 {Gestures.xcodeproj → GesturesDemo.xcodeproj}/project.pbxproj
  10. +7 −0 GesturesDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  11. +13 −0 GesturesDemo/GestureView.h
  12. +7 −6 {Classes → GesturesDemo}/GestureView.m
  13. 0  { → GesturesDemo}/Gestures.json
  14. +16 −0 GesturesDemo/GesturesAppDelegate.h
  15. +8 −14 {Classes → GesturesDemo}/GesturesAppDelegate.m
  16. 0  Gestures_Prefix.pch → GesturesDemo/GesturesDemo_Prefix.pch
  17. +1 −3 {Classes → GesturesDemo}/GesturesViewController.h
  18. +14 −0 GesturesDemo/GesturesViewController.m
  19. 0  { → GesturesDemo}/GesturesViewController.xib
  20. +4 −2 { → GesturesDemo}/Info.plist
  21. +4 −5 { → GesturesDemo}/main.m
  22. +0 −206 MainWindow.xib
  23. +4 −12 README.markdown
View
5 .gitignore
@@ -1,3 +1,2 @@
-build
-*.pbxuser
-*.perspectivev3
+.DS_Store
+xcuserdata
View
20 Classes/GestureView.h
@@ -1,20 +0,0 @@
-//
-// GestureView.h
-// Gestures
-//
-// Created by Adam Preble on 4/27/09.
-// Copyright 2010 Giraffe Lab. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@class GLGestureRecognizer;
-
-@interface GestureView : UIView {
- NSString *caption;
- GLGestureRecognizer *recognizer;
- CGPoint center;
- float score, angle;
-}
-@property (nonatomic, copy) NSString *caption;
-@end
View
22 Classes/GesturesAppDelegate.h
@@ -1,22 +0,0 @@
-//
-// GesturesAppDelegate.h
-// Gestures
-//
-// Created by Adam Preble on 4/27/09.
-// Copyright Giraffe Lab 2009. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@class GesturesViewController;
-
-@interface GesturesAppDelegate : NSObject <UIApplicationDelegate> {
- UIWindow *window;
- GesturesViewController *viewController;
-}
-
-@property (nonatomic, retain) IBOutlet UIWindow *window;
-@property (nonatomic, retain) IBOutlet GesturesViewController *viewController;
-
-@end
-
View
59 Classes/GesturesViewController.m
@@ -1,59 +0,0 @@
-//
-// GesturesViewController.m
-// Gestures
-//
-// Created by Adam Preble on 4/27/09.
-// Copyright Giraffe Lab 2009. All rights reserved.
-//
-
-#import "GesturesViewController.h"
-
-@implementation GesturesViewController
-
-
-
-/*
-// The designated initializer. Override to perform setup that is required before the view is loaded.
-- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
- if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
- // Custom initialization
- }
- return self;
-}
-*/
-
-/*
-// Implement loadView to create a view hierarchy programmatically, without using a nib.
-- (void)loadView {
-}
-*/
-
-
-/*
-// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
-- (void)viewDidLoad {
- [super viewDidLoad];
-}
-*/
-
-
-/*
-// Override to allow orientations other than the default portrait orientation.
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
- // Return YES for supported orientations
- return (interfaceOrientation == UIInterfaceOrientationPortrait);
-}
-*/
-
-
-- (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
- // Release anything that's not essential, such as cached data
-}
-
-
-- (void)dealloc {
- [super dealloc];
-}
-
-@end
View
0  Classes/GLGestureRecognizer+JSONTemplates.h → ...nizer/GLGestureRecognizer+JSONTemplates.h
File renamed without changes
View
20 Classes/GLGestureRecognizer+JSONTemplates.m → ...nizer/GLGestureRecognizer+JSONTemplates.m
@@ -8,9 +8,6 @@
#import "GLGestureRecognizer+JSONTemplates.h"
-// From TouchCode.com's TouchJSON:
-#import "CJSONDeserializer.h"
-
@implementation GLGestureRecognizer (JSONTemplates)
- (BOOL)loadTemplatesFromJsonData:(NSData *)jsonData
@@ -21,19 +18,18 @@ - (BOOL)loadTemplatesFromJsonData:(NSData *)jsonData
// (A dictionary with string key names and an array of 2-element array coordinate pairs.)
// To populate the file, use the output of the NSLog()s in findBestMatch..: after drawing a shape.
NSError *error = nil;
- NSDictionary *dict = [[CJSONDeserializer deserializer] deserializeAsDictionary:jsonData error:&error];
+ NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error];
NSMutableDictionary *output = [NSMutableDictionary dictionary];
- for (NSString *key in [dict allKeys])
- {
- NSArray *value = [dict objectForKey:key];
- NSMutableArray *points = [NSMutableArray array];
+ [dict enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSArray *value, BOOL *stop) {
+ NSMutableArray *points = [NSMutableArray arrayWithCapacity:value.count];
for (NSArray *pointArray in value)
{
- [points addObject:[NSValue valueWithCGPoint:CGPointMake([[pointArray objectAtIndex:0] floatValue], [[pointArray objectAtIndex:1] floatValue])]];
+ CGPoint point = CGPointMake([pointArray[0] floatValue], [pointArray[1] floatValue]);
+ [points addObject:[NSValue valueWithCGPoint:point]];
}
- [output setObject:points forKey:key];
- }
- self.templates = output;
+ output[key] = [points copy]; // mutable to immutable
+ }];
+ self.templates = [output copy]; // mutable to immuatable
return YES;
}
View
18 Classes/GLGestureRecognizer.h → GLGestureRecognizer/GLGestureRecognizer.h
@@ -1,6 +1,5 @@
//
// GLGestureRecognizer.h
-// Gestures
//
// Created by Adam Preble on 4/28/09. adam@giraffelab.com
//
@@ -8,18 +7,17 @@
#import <Foundation/Foundation.h>
-@interface GLGestureRecognizer : NSObject {
- NSMutableArray *touchPoints;
- NSMutableArray *resampledPoints;
- NSDictionary *templates;
-}
-@property (nonatomic, retain) NSDictionary *templates;
-@property (nonatomic, retain) NSMutableArray *touchPoints;
-@property (nonatomic, retain) NSArray *resampledPoints;
+@interface GLGestureRecognizer : NSObject
+
+@property (nonatomic, strong) NSDictionary *templates;
+@property (nonatomic, readonly) NSArray *touchPoints;
+@property (nonatomic, readonly) NSArray *resampledPoints;
-- (void)addTouches:(NSSet*)set fromView:(UIView *)view;
- (void)addTouchAtPoint:(CGPoint)point;
+- (void)addTouches:(NSSet*)set fromView:(UIView *)view;
- (void)resetTouches;
+
- (NSString *)findBestMatch;
- (NSString *)findBestMatchCenter:(CGPoint*)outCenter angle:(float*)outRadians score:(float*)outScore;
+
@end
View
194 Classes/GLGestureRecognizer.m → GLGestureRecognizer/GLGestureRecognizer.m
@@ -1,6 +1,5 @@
//
// GLGestureRecognizer.m
-// Gestures
//
// Created by Adam Preble on 4/28/09. adam@giraffelab.com
//
@@ -23,6 +22,16 @@
float DistanceAtBestAngle(CGPoint *samples, int samplePoints, CGPoint *template);
+@interface GLGestureRecognizer () {
+ NSMutableArray *touchPoints;
+ NSMutableArray *resampledPoints;
+ NSDictionary *templates;
+}
+@property (nonatomic, readwrite) NSArray *touchPoints;
+@property (nonatomic, readwrite) NSArray *resampledPoints;
+
+@end
+
@implementation GLGestureRecognizer
@synthesize templates, resampledPoints, touchPoints;
@@ -37,12 +46,6 @@ - (id)init
}
return self;
}
-- (void)dealloc
-{
- self.touchPoints = nil;
- self.templates = nil;
- [super dealloc];
-}
- (void)addTouches:(NSSet*)set fromView:(UIView *)view
{
@@ -50,7 +53,7 @@ - (void)addTouches:(NSSet*)set fromView:(UIView *)view
}
- (void)addTouchAtPoint:(CGPoint)point
{
- [[self touchPoints] addObject:[NSValue valueWithCGPoint:point]];
+ [touchPoints addObject:[NSValue valueWithCGPoint:point]];
}
- (void)resetTouches
{
@@ -62,101 +65,100 @@ - (NSString *)findBestMatch
}
- (NSString *)findBestMatchCenter:(CGPoint*)outCenter angle:(float*)outRadians score:(float*)outScore
{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- // Adapted from description on: http://depts.washington.edu/aimgroup/proj/dollar/ / http://blog.makezine.com/archive/2008/11/gesture_recognition_for_javasc.html
- // 1. Resampling the recorded path into a fixed number of points that are evenly spaced along the path
- // 2. Rotate the path so that the first point is directly to the right of the path's center of mass
- // 3. Scaling the path (non-uniformly) to a fixed height and width
- // 4. For each reference path, calculating the average distance for the corresponding points in the input path. The path with the lowest average point distance is the match.
- int i;
- const int samplePoints = kSamplePoints;
- CGPoint samples[samplePoints];
- int c = [[self touchPoints] count];
-
- // Load up the samples. We use a very simplistic method for this; the JavaScript version is much more sophisticated.
- for (i = 0; i < samplePoints; i++)
- {
- samples[i] = [[[self touchPoints] objectAtIndex:MAX(0, (c-1)*i/(samplePoints-1))] CGPointValue];
- }
-
- CGPoint center = Centroid(samples, samplePoints);
- if (outCenter)
- *outCenter = center;
- Translate(samples, samplePoints, -center.x, -center.y); // Recenter
-
- // Now rotate the path around 0,0, since the points have been transformed to that point.
- // Find the angle of the first point:
- CGPoint firstPoint = samples[0];
- float firstPointAngle = atan2(firstPoint.y, firstPoint.x);
- NSLog(@"firstPointAngle=%0.2f", firstPointAngle*360.0f/(2.0f*M_PI));
- if (outRadians)
- *outRadians = firstPointAngle;
- Rotate(samples, samplePoints, -firstPointAngle);
-
- CGPoint lowerLeft, upperRight; // For finding the boundaries of the gesture
- for (i = 0; i < samplePoints; i++)
- {
- CGPoint pt = samples[i];
- if (pt.x < lowerLeft.x)
- lowerLeft.x = pt.x;
- if (pt.y < lowerLeft.y)
- lowerLeft.y = pt.y;
- if (pt.x > upperRight.x)
- upperRight.x = pt.x;
- if (pt.y > upperRight.y)
- upperRight.y = pt.y;
- }
- float scale = 2.0f/MAX(upperRight.x - lowerLeft.x, upperRight.y - lowerLeft.y);
- Scale(samples, samplePoints, scale, scale);
-
- center = Centroid(samples, samplePoints);
- Translate(samples, samplePoints, -center.x, -center.y); // Recenter
-
- // Now we can compare the samples against our known samples:
- NSString *bestTemplateName = nil;
- float best = INFINITY;
- for (NSString *templateName in [templates allKeys])
- {
- NSArray *templateSamples = [templates objectForKey:templateName];
- CGPoint template[samplePoints];
- NSAssert(samplePoints == [templateSamples count], @"Template size mismatch");
+ @autoreleasepool {
+ // Adapted from description on: http://depts.washington.edu/aimgroup/proj/dollar/ / http://blog.makezine.com/archive/2008/11/gesture_recognition_for_javasc.html
+ // 1. Resampling the recorded path into a fixed number of points that are evenly spaced along the path
+ // 2. Rotate the path so that the first point is directly to the right of the path's center of mass
+ // 3. Scaling the path (non-uniformly) to a fixed height and width
+ // 4. For each reference path, calculating the average distance for the corresponding points in the input path. The path with the lowest average point distance is the match.
+ int i;
+ const int samplePoints = kSamplePoints;
+ CGPoint samples[samplePoints];
+ int c = [[self touchPoints] count];
+
+ // Load up the samples. We use a very simplistic method for this; the JavaScript version is much more sophisticated.
for (i = 0; i < samplePoints; i++)
{
- template[i] = [[templateSamples objectAtIndex:i] CGPointValue];
+ samples[i] = [[[self touchPoints] objectAtIndex:MAX(0, (c-1)*i/(samplePoints-1))] CGPointValue];
}
- float score = DistanceAtBestAngle(samples, samplePoints, template);
- NSLog(@" %@ => %0.2f", templateName, score);
- if (score < best)
+
+ CGPoint center = Centroid(samples, samplePoints);
+ if (outCenter)
+ *outCenter = center;
+ Translate(samples, samplePoints, -center.x, -center.y); // Recenter
+
+ // Now rotate the path around 0,0, since the points have been transformed to that point.
+ // Find the angle of the first point:
+ CGPoint firstPoint = samples[0];
+ float firstPointAngle = atan2(firstPoint.y, firstPoint.x);
+ NSLog(@"firstPointAngle=%0.2f", firstPointAngle*360.0f/(2.0f*M_PI));
+ if (outRadians)
+ *outRadians = firstPointAngle;
+ Rotate(samples, samplePoints, -firstPointAngle);
+
+ CGPoint lowerLeft, upperRight; // For finding the boundaries of the gesture
+ for (i = 0; i < samplePoints; i++)
{
- bestTemplateName = [NSString stringWithString:templateName];
- best = score;
+ CGPoint pt = samples[i];
+ if (pt.x < lowerLeft.x)
+ lowerLeft.x = pt.x;
+ if (pt.y < lowerLeft.y)
+ lowerLeft.y = pt.y;
+ if (pt.x > upperRight.x)
+ upperRight.x = pt.x;
+ if (pt.y > upperRight.y)
+ upperRight.y = pt.y;
}
- }
- NSLog(@"Best: %@ with %0.2f", bestTemplateName, best);
- if (outScore)
- *outScore = best;
-
- self.resampledPoints = [NSMutableArray arrayWithCapacity:samplePoints];
- for (i = 0; i < samplePoints; i++)
- {
- CGPoint pt = samples[i];
- [resampledPoints addObject:[NSValue valueWithCGPoint:pt]];
- }
-
- // Serialize the samples as JSON:
+ float scale = 2.0f/MAX(upperRight.x - lowerLeft.x, upperRight.y - lowerLeft.y);
+ Scale(samples, samplePoints, scale, scale);
+
+ center = Centroid(samples, samplePoints);
+ Translate(samples, samplePoints, -center.x, -center.y); // Recenter
+
+ // Now we can compare the samples against our known samples:
+ NSString *bestTemplateName = nil;
+ float best = INFINITY;
+ for (NSString *templateName in [templates allKeys])
+ {
+ NSArray *templateSamples = [templates objectForKey:templateName];
+ CGPoint template[samplePoints];
+ NSAssert(samplePoints == [templateSamples count], @"Template size mismatch");
+ for (i = 0; i < samplePoints; i++)
+ {
+ template[i] = [[templateSamples objectAtIndex:i] CGPointValue];
+ }
+ float score = DistanceAtBestAngle(samples, samplePoints, template);
+ NSLog(@" %@ => %0.2f", templateName, score);
+ if (score < best)
+ {
+ bestTemplateName = [NSString stringWithString:templateName];
+ best = score;
+ }
+ }
+ NSLog(@"Best: %@ with %0.2f", bestTemplateName, best);
+ if (outScore)
+ *outScore = best;
+
+ self.resampledPoints = [NSMutableArray arrayWithCapacity:samplePoints];
+ for (i = 0; i < samplePoints; i++)
+ {
+ CGPoint pt = samples[i];
+ [resampledPoints addObject:[NSValue valueWithCGPoint:pt]];
+ }
+
+ // Serialize the samples as JSON:
#ifndef NDEBUG
- NSMutableString *string = [NSMutableString stringWithString:@"\"template_name\": [ "];
- for (i = 0; i < samplePoints; i++)
- {
- CGPoint pt = samples[i];
- [string appendFormat:@"\t[%0.2f, %0.2f], ", pt.x, pt.y];
- }
- [string appendString:@"],\n"];
- NSLog(@"Read:\n%@", string);
+ NSMutableString *string = [NSMutableString stringWithString:@"\"template_name\": [ "];
+ for (i = 0; i < samplePoints; i++)
+ {
+ CGPoint pt = samples[i];
+ [string appendFormat:@"[%0.2f, %0.2f], ", pt.x, pt.y];
+ }
+ [string appendString:@"],\n"];
+ NSLog(@"Read:\n%@", string);
#endif
- [bestTemplateName retain]; // +1 retain count because it is autoreleased, and we're about to drain the pool.
- [pool release];
- return [bestTemplateName autorelease];
+ return bestTemplateName;
+ }
}
@end
View
153 Gestures.xcodeproj/project.pbxproj → GesturesDemo.xcodeproj/project.pbxproj
@@ -13,17 +13,9 @@
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; };
2899E5220DE3E06400AC0155 /* GesturesViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2899E5210DE3E06400AC0155 /* GesturesViewController.xib */; };
- 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; };
28D7ACF80DDB3853001CB0EB /* GesturesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* GesturesViewController.m */; };
664F538A123BE1FC00037D3C /* GLGestureRecognizer+JSONTemplates.m in Sources */ = {isa = PBXBuildFile; fileRef = 664F5389123BE1FC00037D3C /* GLGestureRecognizer+JSONTemplates.m */; };
66597BE90FA682C100CCA91E /* GestureView.m in Sources */ = {isa = PBXBuildFile; fileRef = 66597BE80FA682C100CCA91E /* GestureView.m */; };
- 66597CFF0FA6AEBB00CCA91E /* NSCharacterSet_Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 66597CF10FA6AEBB00CCA91E /* NSCharacterSet_Extensions.m */; };
- 66597D000FA6AEBB00CCA91E /* CDataScanner_Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 66597CF30FA6AEBB00CCA91E /* CDataScanner_Extensions.m */; };
- 66597D010FA6AEBB00CCA91E /* NSDictionary_JSONExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 66597CF50FA6AEBB00CCA91E /* NSDictionary_JSONExtensions.m */; };
- 66597D020FA6AEBB00CCA91E /* CJSONScanner.m in Sources */ = {isa = PBXBuildFile; fileRef = 66597CF80FA6AEBB00CCA91E /* CJSONScanner.m */; };
- 66597D030FA6AEBB00CCA91E /* CJSONSerializer.m in Sources */ = {isa = PBXBuildFile; fileRef = 66597CFA0FA6AEBB00CCA91E /* CJSONSerializer.m */; };
- 66597D040FA6AEBB00CCA91E /* CJSONDeserializer.m in Sources */ = {isa = PBXBuildFile; fileRef = 66597CFC0FA6AEBB00CCA91E /* CJSONDeserializer.m */; };
- 66597D050FA6AEBB00CCA91E /* CDataScanner.m in Sources */ = {isa = PBXBuildFile; fileRef = 66597CFE0FA6AEBB00CCA91E /* CDataScanner.m */; };
66597D070FA6AF1D00CCA91E /* Gestures.json in Resources */ = {isa = PBXBuildFile; fileRef = 66597D060FA6AF1D00CCA91E /* Gestures.json */; };
66597D670FA7B95300CCA91E /* GLGestureRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 66597D660FA7B95300CCA91E /* GLGestureRecognizer.m */; };
/* End PBXBuildFile section */
@@ -32,35 +24,20 @@
1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
1D3623240D0F684500981E51 /* GesturesAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GesturesAppDelegate.h; sourceTree = "<group>"; };
1D3623250D0F684500981E51 /* GesturesAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GesturesAppDelegate.m; sourceTree = "<group>"; };
- 1D6058910D05DD3D006BFB54 /* Gestures.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Gestures.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 1D6058910D05DD3D006BFB54 /* GesturesDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GesturesDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
2899E5210DE3E06400AC0155 /* GesturesViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GesturesViewController.xib; sourceTree = "<group>"; };
- 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = "<group>"; };
28D7ACF60DDB3853001CB0EB /* GesturesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GesturesViewController.h; sourceTree = "<group>"; };
28D7ACF70DDB3853001CB0EB /* GesturesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GesturesViewController.m; sourceTree = "<group>"; };
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
- 32CA4F630368D1EE00C91783 /* Gestures_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Gestures_Prefix.pch; sourceTree = "<group>"; };
+ 32CA4F630368D1EE00C91783 /* GesturesDemo_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GesturesDemo_Prefix.pch; sourceTree = "<group>"; };
664F537F123BE0E900037D3C /* README.markdown */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.markdown; sourceTree = "<group>"; wrapsLines = 1; };
664F5388123BE1FC00037D3C /* GLGestureRecognizer+JSONTemplates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GLGestureRecognizer+JSONTemplates.h"; sourceTree = "<group>"; };
664F5389123BE1FC00037D3C /* GLGestureRecognizer+JSONTemplates.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GLGestureRecognizer+JSONTemplates.m"; sourceTree = "<group>"; };
66597BE70FA682C100CCA91E /* GestureView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GestureView.h; sourceTree = "<group>"; };
66597BE80FA682C100CCA91E /* GestureView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GestureView.m; sourceTree = "<group>"; };
- 66597CF00FA6AEBB00CCA91E /* NSCharacterSet_Extensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSCharacterSet_Extensions.h; sourceTree = "<group>"; };
- 66597CF10FA6AEBB00CCA91E /* NSCharacterSet_Extensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSCharacterSet_Extensions.m; sourceTree = "<group>"; };
- 66597CF20FA6AEBB00CCA91E /* CDataScanner_Extensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDataScanner_Extensions.h; sourceTree = "<group>"; };
- 66597CF30FA6AEBB00CCA91E /* CDataScanner_Extensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDataScanner_Extensions.m; sourceTree = "<group>"; };
- 66597CF40FA6AEBB00CCA91E /* NSDictionary_JSONExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSDictionary_JSONExtensions.h; sourceTree = "<group>"; };
- 66597CF50FA6AEBB00CCA91E /* NSDictionary_JSONExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSDictionary_JSONExtensions.m; sourceTree = "<group>"; };
- 66597CF70FA6AEBB00CCA91E /* CJSONScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CJSONScanner.h; sourceTree = "<group>"; };
- 66597CF80FA6AEBB00CCA91E /* CJSONScanner.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CJSONScanner.m; sourceTree = "<group>"; };
- 66597CF90FA6AEBB00CCA91E /* CJSONSerializer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CJSONSerializer.h; sourceTree = "<group>"; };
- 66597CFA0FA6AEBB00CCA91E /* CJSONSerializer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CJSONSerializer.m; sourceTree = "<group>"; };
- 66597CFB0FA6AEBB00CCA91E /* CJSONDeserializer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CJSONDeserializer.h; sourceTree = "<group>"; };
- 66597CFC0FA6AEBB00CCA91E /* CJSONDeserializer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CJSONDeserializer.m; sourceTree = "<group>"; };
- 66597CFD0FA6AEBB00CCA91E /* CDataScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDataScanner.h; sourceTree = "<group>"; };
- 66597CFE0FA6AEBB00CCA91E /* CDataScanner.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDataScanner.m; sourceTree = "<group>"; };
- 66597D060FA6AF1D00CCA91E /* Gestures.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Gestures.json; sourceTree = "<group>"; };
+ 66597D060FA6AF1D00CCA91E /* Gestures.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = Gestures.json; sourceTree = "<group>"; };
66597D650FA7B95300CCA91E /* GLGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLGestureRecognizer.h; sourceTree = "<group>"; };
66597D660FA7B95300CCA91E /* GLGestureRecognizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GLGestureRecognizer.m; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -80,25 +57,25 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
- 080E96DDFE201D6D7F000001 /* Classes */ = {
+ 080E96DDFE201D6D7F000001 /* GesturesDemo */ = {
isa = PBXGroup;
children = (
- 664F5387123BE1B700037D3C /* GLGestureRecognizer */,
- 66597CEE0FA6AEBB00CCA91E /* TouchJSON */,
1D3623240D0F684500981E51 /* GesturesAppDelegate.h */,
1D3623250D0F684500981E51 /* GesturesAppDelegate.m */,
28D7ACF60DDB3853001CB0EB /* GesturesViewController.h */,
28D7ACF70DDB3853001CB0EB /* GesturesViewController.m */,
+ 2899E5210DE3E06400AC0155 /* GesturesViewController.xib */,
66597BE70FA682C100CCA91E /* GestureView.h */,
66597BE80FA682C100CCA91E /* GestureView.m */,
+ 66597D060FA6AF1D00CCA91E /* Gestures.json */,
);
- path = Classes;
+ path = GesturesDemo;
sourceTree = "<group>";
};
19C28FACFE9D520D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
- 1D6058910D05DD3D006BFB54 /* Gestures.app */,
+ 1D6058910D05DD3D006BFB54 /* GesturesDemo.app */,
);
name = Products;
sourceTree = "<group>";
@@ -106,34 +83,25 @@
29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
isa = PBXGroup;
children = (
- 080E96DDFE201D6D7F000001 /* Classes */,
- 29B97315FDCFA39411CA2CEA /* Other Sources */,
- 29B97317FDCFA39411CA2CEA /* Resources */,
+ 664F537F123BE0E900037D3C /* README.markdown */,
+ 664F5387123BE1B700037D3C /* GLGestureRecognizer */,
+ 080E96DDFE201D6D7F000001 /* GesturesDemo */,
+ 29B97315FDCFA39411CA2CEA /* Supporting Files */,
29B97323FDCFA39411CA2CEA /* Frameworks */,
- 664F537E123BE0CF00037D3C /* Documentation */,
19C28FACFE9D520D11CA2CBB /* Products */,
);
name = CustomTemplate;
sourceTree = "<group>";
};
- 29B97315FDCFA39411CA2CEA /* Other Sources */ = {
+ 29B97315FDCFA39411CA2CEA /* Supporting Files */ = {
isa = PBXGroup;
children = (
- 32CA4F630368D1EE00C91783 /* Gestures_Prefix.pch */,
+ 32CA4F630368D1EE00C91783 /* GesturesDemo_Prefix.pch */,
29B97316FDCFA39411CA2CEA /* main.m */,
- );
- name = "Other Sources";
- sourceTree = "<group>";
- };
- 29B97317FDCFA39411CA2CEA /* Resources */ = {
- isa = PBXGroup;
- children = (
- 66597D060FA6AF1D00CCA91E /* Gestures.json */,
- 2899E5210DE3E06400AC0155 /* GesturesViewController.xib */,
- 28AD733E0D9D9553002E5188 /* MainWindow.xib */,
8D1107310486CEB800E47090 /* Info.plist */,
);
- name = Resources;
+ name = "Supporting Files";
+ path = GesturesDemo;
sourceTree = "<group>";
};
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
@@ -146,14 +114,6 @@
name = Frameworks;
sourceTree = "<group>";
};
- 664F537E123BE0CF00037D3C /* Documentation */ = {
- isa = PBXGroup;
- children = (
- 664F537F123BE0E900037D3C /* README.markdown */,
- );
- name = Documentation;
- sourceTree = "<group>";
- };
664F5387123BE1B700037D3C /* GLGestureRecognizer */ = {
isa = PBXGroup;
children = (
@@ -162,52 +122,15 @@
664F5388123BE1FC00037D3C /* GLGestureRecognizer+JSONTemplates.h */,
664F5389123BE1FC00037D3C /* GLGestureRecognizer+JSONTemplates.m */,
);
- name = GLGestureRecognizer;
- sourceTree = "<group>";
- };
- 66597CEE0FA6AEBB00CCA91E /* TouchJSON */ = {
- isa = PBXGroup;
- children = (
- 66597CEF0FA6AEBB00CCA91E /* Extensions */,
- 66597CF60FA6AEBB00CCA91E /* JSON */,
- 66597CFD0FA6AEBB00CCA91E /* CDataScanner.h */,
- 66597CFE0FA6AEBB00CCA91E /* CDataScanner.m */,
- );
- path = TouchJSON;
- sourceTree = "<group>";
- };
- 66597CEF0FA6AEBB00CCA91E /* Extensions */ = {
- isa = PBXGroup;
- children = (
- 66597CF00FA6AEBB00CCA91E /* NSCharacterSet_Extensions.h */,
- 66597CF10FA6AEBB00CCA91E /* NSCharacterSet_Extensions.m */,
- 66597CF20FA6AEBB00CCA91E /* CDataScanner_Extensions.h */,
- 66597CF30FA6AEBB00CCA91E /* CDataScanner_Extensions.m */,
- 66597CF40FA6AEBB00CCA91E /* NSDictionary_JSONExtensions.h */,
- 66597CF50FA6AEBB00CCA91E /* NSDictionary_JSONExtensions.m */,
- );
- path = Extensions;
- sourceTree = "<group>";
- };
- 66597CF60FA6AEBB00CCA91E /* JSON */ = {
- isa = PBXGroup;
- children = (
- 66597CF70FA6AEBB00CCA91E /* CJSONScanner.h */,
- 66597CF80FA6AEBB00CCA91E /* CJSONScanner.m */,
- 66597CF90FA6AEBB00CCA91E /* CJSONSerializer.h */,
- 66597CFA0FA6AEBB00CCA91E /* CJSONSerializer.m */,
- 66597CFB0FA6AEBB00CCA91E /* CJSONDeserializer.h */,
- 66597CFC0FA6AEBB00CCA91E /* CJSONDeserializer.m */,
- );
- path = JSON;
+ path = GLGestureRecognizer;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
- 1D6058900D05DD3D006BFB54 /* Gestures */ = {
+ 1D6058900D05DD3D006BFB54 /* GesturesDemo */ = {
isa = PBXNativeTarget;
- buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "Gestures" */;
+ buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "GesturesDemo" */;
buildPhases = (
1D60588D0D05DD3D006BFB54 /* Resources */,
1D60588E0D05DD3D006BFB54 /* Sources */,
@@ -217,9 +140,9 @@
);
dependencies = (
);
- name = Gestures;
+ name = GesturesDemo;
productName = Gestures;
- productReference = 1D6058910D05DD3D006BFB54 /* Gestures.app */;
+ productReference = 1D6058910D05DD3D006BFB54 /* GesturesDemo.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
@@ -227,7 +150,7 @@
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
- buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Gestures" */;
+ buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "GesturesDemo" */;
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
hasScannedForEncodings = 1;
@@ -241,7 +164,7 @@
projectDirPath = "";
projectRoot = "";
targets = (
- 1D6058900D05DD3D006BFB54 /* Gestures */,
+ 1D6058900D05DD3D006BFB54 /* GesturesDemo */,
);
};
/* End PBXProject section */
@@ -251,7 +174,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */,
2899E5220DE3E06400AC0155 /* GesturesViewController.xib in Resources */,
66597D070FA6AF1D00CCA91E /* Gestures.json in Resources */,
);
@@ -268,13 +190,6 @@
1D3623260D0F684500981E51 /* GesturesAppDelegate.m in Sources */,
28D7ACF80DDB3853001CB0EB /* GesturesViewController.m in Sources */,
66597BE90FA682C100CCA91E /* GestureView.m in Sources */,
- 66597CFF0FA6AEBB00CCA91E /* NSCharacterSet_Extensions.m in Sources */,
- 66597D000FA6AEBB00CCA91E /* CDataScanner_Extensions.m in Sources */,
- 66597D010FA6AEBB00CCA91E /* NSDictionary_JSONExtensions.m in Sources */,
- 66597D020FA6AEBB00CCA91E /* CJSONScanner.m in Sources */,
- 66597D030FA6AEBB00CCA91E /* CJSONSerializer.m in Sources */,
- 66597D040FA6AEBB00CCA91E /* CJSONDeserializer.m in Sources */,
- 66597D050FA6AEBB00CCA91E /* CDataScanner.m in Sources */,
66597D670FA7B95300CCA91E /* GLGestureRecognizer.m in Sources */,
664F538A123BE1FC00037D3C /* GLGestureRecognizer+JSONTemplates.m in Sources */,
);
@@ -287,13 +202,14 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = Gestures_Prefix.pch;
- INFOPLIST_FILE = Info.plist;
- PRODUCT_NAME = Gestures;
+ GCC_PREFIX_HEADER = GesturesDemo/GesturesDemo_Prefix.pch;
+ INFOPLIST_FILE = "$(SRCROOT)/GesturesDemo/Info.plist";
+ PRODUCT_NAME = GesturesDemo;
};
name = Debug;
};
@@ -301,11 +217,12 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = Gestures_Prefix.pch;
- INFOPLIST_FILE = Info.plist;
- PRODUCT_NAME = Gestures;
+ GCC_PREFIX_HEADER = GesturesDemo/GesturesDemo_Prefix.pch;
+ INFOPLIST_FILE = "$(SRCROOT)/GesturesDemo/Info.plist";
+ PRODUCT_NAME = GesturesDemo;
};
name = Release;
};
@@ -319,7 +236,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
- SDKROOT = iphoneos4.1;
+ SDKROOT = iphoneos;
};
name = Debug;
};
@@ -332,14 +249,14 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
- SDKROOT = iphoneos4.1;
+ SDKROOT = iphoneos;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
- 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "Gestures" */ = {
+ 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "GesturesDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1D6058940D05DD3E006BFB54 /* Debug */,
@@ -348,7 +265,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
- C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Gestures" */ = {
+ C01FCF4E08A954540054247B /* Build configuration list for PBXProject "GesturesDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4F08A954540054247B /* Debug */,
View
7 GesturesDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:GesturesDemo.xcodeproj">
+ </FileRef>
+</Workspace>
View
13 GesturesDemo/GestureView.h
@@ -0,0 +1,13 @@
+//
+// GestureView.h
+// Gestures
+//
+// Created by Adam Preble on 4/27/09.
+// Copyright 2010 Giraffe Lab. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface GestureView : UIView
+
+@end
View
13 Classes/GestureView.m → GesturesDemo/GestureView.m
@@ -10,7 +10,13 @@
#import "GLGestureRecognizer.h"
#import "GLGestureRecognizer+JSONTemplates.h"
-@interface GestureView ()
+@interface GestureView () {
+ GLGestureRecognizer *recognizer;
+ CGPoint center;
+ float score, angle;
+}
+@property (nonatomic, copy) NSString *caption;
+
@end
@implementation GestureView
@@ -24,11 +30,6 @@ - (id)initWithFrame:(CGRect)frame {
return self;
}
-- (void)dealloc {
- self.caption = nil;
- [recognizer release];
- [super dealloc];
-}
- (void)awakeFromNib
{
View
0  Gestures.json → GesturesDemo/Gestures.json
File renamed without changes
View
16 GesturesDemo/GesturesAppDelegate.h
@@ -0,0 +1,16 @@
+//
+// GesturesAppDelegate.h
+// Gestures
+//
+// Created by Adam Preble on 4/27/09.
+// Copyright Giraffe Lab 2009. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface GesturesAppDelegate : NSObject <UIApplicationDelegate>
+
+@property (nonatomic, strong) UIWindow *window;
+
+@end
+
View
22 Classes/GesturesAppDelegate.m → GesturesDemo/GesturesAppDelegate.m
@@ -12,22 +12,16 @@
@implementation GesturesAppDelegate
@synthesize window;
-@synthesize viewController;
+- (void)applicationDidFinishLaunching:(UIApplication *)application
+{
+ self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+ self.window.backgroundColor = [UIColor whiteColor];
+
+ GesturesViewController *vc = [[GesturesViewController alloc] init];
+ self.window.rootViewController = vc;
-- (void)applicationDidFinishLaunching:(UIApplication *)application {
-
- // Override point for customization after app launch
- [window addSubview:viewController.view];
- [window makeKeyAndVisible];
+ [self.window makeKeyAndVisible];
}
-
-- (void)dealloc {
- [viewController release];
- [window release];
- [super dealloc];
-}
-
-
@end
View
0  Gestures_Prefix.pch → GesturesDemo/GesturesDemo_Prefix.pch
File renamed without changes
View
4 Classes/GesturesViewController.h → GesturesDemo/GesturesViewController.h
@@ -8,9 +8,7 @@
#import <UIKit/UIKit.h>
-@interface GesturesViewController : UIViewController {
-
-}
+@interface GesturesViewController : UIViewController
@end
View
14 GesturesDemo/GesturesViewController.m
@@ -0,0 +1,14 @@
+//
+// GesturesViewController.m
+// Gestures
+//
+// Created by Adam Preble on 4/27/09.
+// Copyright Giraffe Lab 2009. All rights reserved.
+//
+
+#import "GesturesViewController.h"
+
+@implementation GesturesViewController
+
+
+@end
View
0  GesturesViewController.xib → GesturesDemo/GesturesViewController.xib
File renamed without changes
View
6 Info.plist → GesturesDemo/Info.plist
@@ -24,7 +24,9 @@
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
- <key>NSMainNibFile</key>
- <string>MainWindow</string>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ </array>
</dict>
</plist>
View
9 main.m → GesturesDemo/main.m
@@ -7,11 +7,10 @@
//
#import <UIKit/UIKit.h>
+#import "GesturesAppDelegate.h"
int main(int argc, char *argv[]) {
-
- NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
- int retVal = UIApplicationMain(argc, argv, nil, nil);
- [pool release];
- return retVal;
+ @autoreleasepool {
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([GesturesAppDelegate class]));
+ }
}
View
206 MainWindow.xib
@@ -1,206 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.02">
- <data>
- <int key="IBDocument.SystemTarget">528</int>
- <string key="IBDocument.SystemVersion">9E17</string>
- <string key="IBDocument.InterfaceBuilderVersion">672</string>
- <string key="IBDocument.AppKitVersion">949.33</string>
- <string key="IBDocument.HIToolboxVersion">352.00</string>
- <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="10"/>
- </object>
- <object class="NSArray" key="IBDocument.PluginDependencies">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- </object>
- <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBProxyObject" id="841351856">
- <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
- </object>
- <object class="IBProxyObject" id="427554174">
- <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
- </object>
- <object class="IBUICustomObject" id="664661524"/>
- <object class="IBUIViewController" id="943309135">
- <string key="IBUINibName">GesturesViewController</string>
- <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
- </object>
- <object class="IBUIWindow" id="117978783">
- <nil key="NSNextResponder"/>
- <int key="NSvFlags">292</int>
- <string key="NSFrameSize">{320, 480}</string>
- <object class="NSColor" key="IBUIBackgroundColor">
- <int key="NSColorSpace">1</int>
- <bytes key="NSRGB">MSAxIDEAA</bytes>
- </object>
- <bool key="IBUIOpaque">NO</bool>
- <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
- <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
- </object>
- </object>
- <object class="IBObjectContainer" key="IBDocument.Objects">
- <object class="NSMutableArray" key="connectionRecords">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="841351856"/>
- <reference key="destination" ref="664661524"/>
- </object>
- <int key="connectionID">4</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">viewController</string>
- <reference key="source" ref="664661524"/>
- <reference key="destination" ref="943309135"/>
- </object>
- <int key="connectionID">11</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">window</string>
- <reference key="source" ref="664661524"/>
- <reference key="destination" ref="117978783"/>
- </object>
- <int key="connectionID">14</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="957960031">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <reference key="children" ref="1000"/>
- <nil key="parent"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-1</int>
- <reference key="object" ref="841351856"/>
- <reference key="parent" ref="957960031"/>
- <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">3</int>
- <reference key="object" ref="664661524"/>
- <reference key="parent" ref="957960031"/>
- <string key="objectName">Gestures App Delegate</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-2</int>
- <reference key="object" ref="427554174"/>
- <reference key="parent" ref="957960031"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">10</int>
- <reference key="object" ref="943309135"/>
- <reference key="parent" ref="957960031"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">12</int>
- <reference key="object" ref="117978783"/>
- <reference key="parent" ref="957960031"/>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="flattenedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>-1.CustomClassName</string>
- <string>-2.CustomClassName</string>
- <string>10.CustomClassName</string>
- <string>10.IBEditorWindowLastContentRect</string>
- <string>10.IBPluginDependency</string>
- <string>12.IBEditorWindowLastContentRect</string>
- <string>12.IBPluginDependency</string>
- <string>3.CustomClassName</string>
- <string>3.IBPluginDependency</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>UIApplication</string>
- <string>UIResponder</string>
- <string>GesturesViewController</string>
- <string>{{512, 351}, {320, 480}}</string>
- <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string>{{525, 346}, {320, 480}}</string>
- <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string>GesturesAppDelegate</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>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <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>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="sourceID"/>
- <int key="maxID">14</int>
- </object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <object class="NSMutableArray" key="referencedPartialClassDescriptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">GesturesAppDelegate</string>
- <string key="superclassName">NSObject</string>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>viewController</string>
- <string>window</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>GesturesViewController</string>
- <string>UIWindow</string>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Classes/GesturesAppDelegate.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">GesturesAppDelegate</string>
- <string key="superclassName">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBUserSource</string>
- <string key="minorKey"/>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">GesturesViewController</string>
- <string key="superclassName">UIViewController</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Classes/GesturesViewController.h</string>
- </object>
- </object>
- </object>
- </object>
- <int key="IBDocument.localizationMode">0</int>
- <string key="IBDocument.LastKnownRelativeProjectPath">Gestures.xcodeproj</string>
- <int key="IBDocument.defaultPropertyAccessControl">3</int>
- </data>
-</archive>
View
16 README.markdown
@@ -3,29 +3,21 @@
GLGestureRecognizer is an Objective-C implementation of the [$1 Unistroke Recognizer](http://depts.washington.edu/aimgroup/proj/dollar/), a simple gesture recognition algorithm (see Credits below). It is made available here in the form of an Objective-C class and iPhone demo application. It was implemented over the course of a couple evenings in late April 2009 by Adam Preble.
-## Prerequisites
-
-GLGestureRecognizer itself has no real prerequisites, but if you want to load your templates from JSON using the included JSONTemplates category you will need TouchJSON from the excellent [TouchCode](http://touchcode.com/) Project. Because the example uses JSON you will need TouchJSON to compile the example. Place it in Classes/TouchJSON:
-
- cd Classes
- svn checkout http://touchcode.googlecode.com/svn/trunk/TouchJSON/Source/ TouchJSON
-
-
## Using GLGestureRecognizer In Your Application
-Simply copy GLGestureRecognizer.h and GLGestureRecognizer.m into your project and add them to your app target. If you wish to load template information (gesture descriptions) from JSON, you will also need GLGestureRecognizer+JSONTemplates.h and .m, which require TouchJSON (see Prerequisites).
+Simply copy `GLGestureRecognizer.h` and `GLGestureRecognizer.m` into your project and add them to your app target. If you wish to load template information (gesture descriptions) from JSON, you will also need `GLGestureRecognizer+JSONTemplates.h` and `.m`.
## Demo Project
-A demo iPhone project (Gestures.xcodeproj) is provided; a UIView subclass (GestureView) receives touch events and sends them to the GLGestureRecognizer class while drawing the touched path in white. Once the gesture is completed, the resampled gesture is shown in green, its center at the red dot, along with the name of the best match, score (lower is better), and gesture orientation. A sample size of 16 points is used in the example, which seems to be adequate for very basic shapes.
+A demo iPhone project (`GesturesDemo.xcodeproj`) is provided; a UIView subclass (`GestureView`) receives touch events and sends them to the `GLGestureRecognizer` class while drawing the touched path in white. Once the gesture is completed, the resampled gesture is shown in green, its center at the red dot, along with the name of the best match, score (lower is better), and gesture orientation. A sample size of 16 points is used in the example, which seems to be adequate for very basic shapes.
## Adding Gestures
-Gestures are added to GLGestureRecognizer using the templates property; see JSONTemplates category method -loadTemplatesFromJsonData: implementation for an example of how that is done.
+Gestures are added to `GLGestureRecognizer` using the templates property; see JSONTemplates category method `-loadTemplatesFromJsonData:` implementation for an example of how that is done.
-You can add more gestures to the demo application by drawing the new gesture in the demo application itself. The demo application will print the points to the console in JSON format, which you can then add to the Gestures.json file to expand the supported set of gestures. You will want to use a similar approach to add more gestures if you choose to use a different serialization method.
+You can add more gestures to the demo application by drawing the new gesture in the demo application itself. The demo application will print the points to the console in JSON format, which you can then add to the `Gestures.json` file to expand the supported set of gestures. You will want to use a similar approach to add more gestures if you choose to use a different serialization method.
## License
Please sign in to comment.
Something went wrong with that request. Please try again.