Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit efd51de8ea53444811d4ea529f510bd5aec9d50f @kailoa committed Mar 23, 2009
@@ -0,0 +1,2 @@
+*.mode1v3
+*.pbxuser
@@ -0,0 +1,22 @@
+//
+// TouchSampleCodeAppDelegate.h
+// TouchSampleCode
+//
+// Created by Kailoa Kadano on 2009/3/23.
+// Copyright 6Tringle LLC 2009. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@class TouchSampleCodeViewController;
+
+@interface TouchSampleCodeAppDelegate : NSObject <UIApplicationDelegate> {
+ UIWindow *window;
+ TouchSampleCodeViewController *viewController;
+}
+
+@property (nonatomic, retain) IBOutlet UIWindow *window;
+@property (nonatomic, retain) IBOutlet TouchSampleCodeViewController *viewController;
+
+@end
+
@@ -0,0 +1,33 @@
+//
+// TouchSampleCodeAppDelegate.m
+// TouchSampleCode
+//
+// Created by Kailoa Kadano on 2009/3/23.
+// Copyright 6Tringle LLC 2009. All rights reserved.
+//
+
+#import "TouchSampleCodeAppDelegate.h"
+#import "TouchSampleCodeViewController.h"
+
+@implementation TouchSampleCodeAppDelegate
+
+@synthesize window;
+@synthesize viewController;
+
+
+- (void)applicationDidFinishLaunching:(UIApplication *)application {
+
+ // Override point for customization after app launch
+ [window addSubview:viewController.view];
+ [window makeKeyAndVisible];
+}
+
+
+- (void)dealloc {
+ [viewController release];
+ [window release];
+ [super dealloc];
+}
+
+
+@end
@@ -0,0 +1,21 @@
+//
+// TouchSampleCodeViewController.h
+// TouchSampleCode
+//
+// Created by Kailoa Kadano on 2009/3/23.
+// Copyright 6Tringle LLC 2009. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "MacroUtilities.h"
+
+@interface TouchSampleCodeViewController : UIViewController
+{
+ IBOutlet UILabel *TouchAndHoldLabel;
+ NSTimer *TouchTimer;
+ NSInteger TouchAndHoldCounter;
+ NSDate *FirstTouchTime;
+}
+
+@end
+
@@ -0,0 +1,85 @@
+//
+// TouchSampleCodeViewController.m
+// TouchSampleCode
+//
+// Created by Kailoa Kadano on 2009/3/23.
+// Copyright 6Tringle LLC 2009. All rights reserved.
+//
+
+#import "TouchSampleCodeViewController.h"
+
+#define kTouchUpdateTimer (1.0/15.0)
+
+@implementation TouchSampleCodeViewController
+
+/*********************************************************************/
+#pragma mark -
+#pragma mark ** Methods **
+
+- (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 {
+ [TouchTimer invalidate];
+ TouchTimer = nil;
+ [super dealloc];
+}
+
+/*********************************************************************/
+#pragma mark -
+#pragma mark ** UIViewController Methods **
+
+// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+}
+
+/*********************************************************************/
+#pragma mark -
+#pragma mark ** Utilities **
+
+- (void)touchIsBeingHeld;
+{
+ TouchAndHoldCounter += 1;
+ TouchAndHoldLabel.transform = CGAffineTransformRotate(TouchAndHoldLabel.transform, .1);
+ NSLog(@"Held for %d counts and %g seconds.", TouchAndHoldCounter, -1*[FirstTouchTime timeIntervalSinceNow]);
+}
+
+/*********************************************************************/
+#pragma mark -
+#pragma mark ** Touch Handlers **
+
+- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
+{
+ METHOD_LOG;
+ //Start touch timer
+ TouchAndHoldCounter = 0.0;
+ FirstTouchTime = [[NSDate alloc] init];
+ TouchTimer = [NSTimer scheduledTimerWithTimeInterval:kTouchUpdateTimer
+ target:self
+ selector:@selector(touchIsBeingHeld)
+ userInfo:nil
+ repeats:YES];
+}
+- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
+{
+ METHOD_LOG;
+}
+- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
+{
+ METHOD_LOG;
+ [TouchTimer invalidate];
+ TouchTimer = nil;
+}
+- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
+{
+ METHOD_LOG;
+ [TouchTimer invalidate];
+ TouchTimer = nil;
+}
+
+@end
@@ -0,0 +1,59 @@
+/*********************************************************************
+ * \file TouchSampleView.h
+ * \author Kailoa Kadano
+ * \date 2009/3/23
+ * \class TouchSampleView
+ * \brief Part of TouchSampleCode
+ * \details
+ *
+ * \abstract CLASS_ABSTRACT
+ * \copyright Copyright 2009 6Tringle LLC. All rights reserved.
+ */
+
+#import <UIKit/UIKit.h>
+#import "MacroUtilities.h"
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#pragma mark -
+#pragma mark ** Constant Defines **
+
+@interface TouchSampleView : UIView {
+ IBOutlet UIViewController *ViewController;
+}
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#pragma mark -
+#pragma mark ** Properties **
+
+//@property(copy, readonly) NSObject *sampleInstanceVariable;
+
+/*********************************************************************/
+#pragma mark -
+#pragma mark ** Methods **
+
+/// BRIEF_DESCRIPTION
+/**
+ DETAILED_DESCRIPTION
+ \param PARAM_NAME PARAM_DESCRIPTION
+ \return RETURN_VAL_DESCRIPTION
+*/
+
+/*********************************************************************/
+#pragma mark -
+#pragma mark ** Validation **
+
+
+/*********************************************************************/
+#pragma mark -
+#pragma mark ** Utilities **
+
+
+/*********************************************************************/
+#pragma mark -
+#pragma mark ** IBActions **
+
+
+/*********************************************************************/
+#pragma mark -
+#pragma mark ** Accesssors **
+
+@end
@@ -0,0 +1,68 @@
+/*********************************************************************
+ * \file TouchSampleView.m
+ * \author Kailoa Kadano
+ * \date 2009/3/23
+ * \class TouchSampleView
+ * \brief Part of TouchSampleCode
+ * \details
+ *
+ * \abstract STRACT
+ * \copyright Copyright 2009 6Tringle LLC. All rights reserved.
+ */
+
+#import "TouchSampleView.h"
+
+
+@interface TouchSampleView (private_interface)
+
+@end
+
+@implementation TouchSampleView
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#pragma mark ** Static Variables **
+
+/*********************************************************************/
+#pragma mark -
+#pragma mark ** Methods **
+
+- (id)initWithFrame:(CGRect)frame {
+ if (self = [super initWithFrame:frame]) {
+ // Initialization code
+ }
+ return self;
+}
+- (void)dealloc {
+ [super dealloc];
+}
+
+/*********************************************************************/
+#pragma mark -
+#pragma mark ** UIView Methods **
+
+- (void)drawRect:(CGRect)rect {
+ // Drawing code
+}
+
+/*********************************************************************/
+#pragma mark -
+#pragma mark ** Touch Handlers **
+
+//For the purpose of this sample code, we are just forwarding all the touch handlers to the view controller for processing.
+- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
+{
+ [ViewController touchesBegan:touches withEvent:event];
+}
+- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
+{
+ [ViewController touchesMoved:touches withEvent:event];
+}
+- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
+{
+ [ViewController touchesEnded:touches withEvent:event];
+}
+- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
+{
+ [ViewController touchesCancelled:touches withEvent:event];
+}
+
+@end
@@ -0,0 +1,30 @@
+<?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>English</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.yourcompany.${PRODUCT_NAME:identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>NSMainNibFile</key>
+ <string>MainWindow</string>
+</dict>
+</plist>
Oops, something went wrong.

0 comments on commit efd51de

Please sign in to comment.