diff --git a/MultipleAccelerometer/Classes/Accelerometer.h b/MultipleAccelerometer/Classes/Accelerometer.h new file mode 100644 index 0000000..eea308b --- /dev/null +++ b/MultipleAccelerometer/Classes/Accelerometer.h @@ -0,0 +1,21 @@ +// +// Accelerometer.h +// +// Created by Andreas Katzian on 15.06.10. +// Copyright 2010 Blackwhale GmbH. All rights reserved. +// + + +@interface Accelerometer : NSObject { + + @private + NSMutableArray *delegates; //array of subscribed delegates + +} + ++ (Accelerometer*) sharedInstance; + +- (void) addDelegate:(id) delegate; +- (void) removeDelegate:(id) delegate; + +@end diff --git a/MultipleAccelerometer/Classes/Accelerometer.m b/MultipleAccelerometer/Classes/Accelerometer.m new file mode 100644 index 0000000..3c4d103 --- /dev/null +++ b/MultipleAccelerometer/Classes/Accelerometer.m @@ -0,0 +1,129 @@ +// +// Accelerometer.m +// +// Created by Andreas Katzian on 15.06.10. +// Copyright 2010 Blackwhale GmbH. All rights reserved. +// +// The singelton pattern which is used was thankfully described at +// http://www.duckrowing.com/2010/05/21/using-the-singleton-pattern-in-objective-c/ +// + +#import "Accelerometer.h" + +// Anonymus category for private properties +// and methods. +@interface Accelerometer () + +@property(nonatomic,retain) NSMutableArray *delegates; //array of subscribed delegates + +@end + + +static Accelerometer* sharedInstance_ = nil; //the shared instance + + +// Class implementation +@implementation Accelerometer + +@synthesize delegates; + + +#pragma mark - +#pragma mark Delegates management + +// Subscribe a new delegate. +- (void) addDelegate:(id) delegate +{ + [self.delegates addObject:delegate]; +} + +// Remove a delegate. +- (void) removeDelegate:(id) delegate +{ + [self.delegates removeObject:delegate]; +} + + +#pragma mark - +#pragma mark UIAccelerometerDelegate delegate + +- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration +{ + @synchronized(sharedInstance_) + { + //Notify all delegates of acceleration event + for(id delegate in self.delegates) + { + [delegate accelerometer:accelerometer didAccelerate:acceleration]; + } + } +} + + +#pragma mark - +#pragma mark Singelton methods + +// Get the shared instance of this singelton. ++ (Accelerometer*) sharedInstance +{ + @synchronized(self) + { + [[self alloc] init]; + } + + return sharedInstance_; +} + +// Overwrite allocWithZone to be sure to +// allocate memory only once. ++ (id)allocWithZone:(NSZone *)zone +{ + @synchronized(self) { + if (sharedInstance_ == nil) { + sharedInstance_ = [super allocWithZone:zone]; + + //additional initialization + sharedInstance_.delegates = [[NSMutableArray alloc] init]; + [UIAccelerometer sharedAccelerometer].delegate = sharedInstance_; + + return sharedInstance_; + } + } + + return nil; +} + +// Nobody should be able to copy +// the shared instance. +- (id)copyWithZone:(NSZone *)zone +{ + return self; +} + +// Retaining the shared instance should not +// effect the retain count. +- (id)retain +{ + return self; +} + +// Releasing the shared instance should not +// effect the retain count. +- (void)release +{ +} + +// Auto-releasing the shared instance should not +// effect the retain count. +- (id)autorelease +{ + return self; +} + +// Retain count should not go to zero. +- (NSUInteger)retainCount +{ + return NSUIntegerMax; +} + +@end diff --git a/MultipleAccelerometer/Classes/MultipleAccelerometerAppDelegate.h b/MultipleAccelerometer/Classes/MultipleAccelerometerAppDelegate.h new file mode 100644 index 0000000..f6acf5c --- /dev/null +++ b/MultipleAccelerometer/Classes/MultipleAccelerometerAppDelegate.h @@ -0,0 +1,22 @@ +// +// MultipleAccelerometerAppDelegate.h +// MultipleAccelerometer +// +// Created by Andreas Katzian on 15.06.10. +// Copyright Blackwhale GmbH 2010. All rights reserved. +// + +#import + +@class MultipleAccelerometerViewController; + +@interface MultipleAccelerometerAppDelegate : NSObject { + UIWindow *window; + MultipleAccelerometerViewController *viewController; +} + +@property (nonatomic, retain) IBOutlet UIWindow *window; +@property (nonatomic, retain) IBOutlet MultipleAccelerometerViewController *viewController; + +@end + diff --git a/MultipleAccelerometer/Classes/MultipleAccelerometerAppDelegate.m b/MultipleAccelerometer/Classes/MultipleAccelerometerAppDelegate.m new file mode 100644 index 0000000..a1881eb --- /dev/null +++ b/MultipleAccelerometer/Classes/MultipleAccelerometerAppDelegate.m @@ -0,0 +1,98 @@ +// +// MultipleAccelerometerAppDelegate.m +// MultipleAccelerometer +// +// Created by Andreas Katzian on 15.06.10. +// Copyright Blackwhale GmbH 2010. All rights reserved. +// + +#import "MultipleAccelerometerAppDelegate.h" +#import "MultipleAccelerometerViewController.h" +#import "Accelerometer.h" +#import "ObserverOne.h" +#import "ObserverTwo.h" + +@implementation MultipleAccelerometerAppDelegate + +@synthesize window; +@synthesize viewController; + + +#pragma mark - +#pragma mark Application lifecycle + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + + // Override point for customization after application launch. + + ObserverOne *one = [[[ObserverOne alloc] init] autorelease]; + ObserverTwo *two = [[[ObserverTwo alloc] init] autorelease]; + + [[Accelerometer sharedInstance] addDelegate:one]; + [[Accelerometer sharedInstance] addDelegate:two]; + + + // Add the view controller's view to the window and display. + [window addSubview:viewController.view]; + [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, called instead of applicationWillTerminate: when the user quits. + */ +} + + +- (void)applicationWillEnterForeground:(UIApplication *)application { + /* + Called as part of 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. + See also applicationDidEnterBackground:. + */ +} + + +#pragma mark - +#pragma mark Memory management + +- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application { + /* + Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later. + */ +} + + +- (void)dealloc { + [viewController release]; + [window release]; + [super dealloc]; +} + + +@end diff --git a/MultipleAccelerometer/Classes/MultipleAccelerometerViewController.h b/MultipleAccelerometer/Classes/MultipleAccelerometerViewController.h new file mode 100644 index 0000000..b752caf --- /dev/null +++ b/MultipleAccelerometer/Classes/MultipleAccelerometerViewController.h @@ -0,0 +1,16 @@ +// +// MultipleAccelerometerViewController.h +// MultipleAccelerometer +// +// Created by Andreas Katzian on 15.06.10. +// Copyright Blackwhale GmbH 2010. All rights reserved. +// + +#import + +@interface MultipleAccelerometerViewController : UIViewController { + +} + +@end + diff --git a/MultipleAccelerometer/Classes/MultipleAccelerometerViewController.m b/MultipleAccelerometer/Classes/MultipleAccelerometerViewController.m new file mode 100644 index 0000000..d9a6f6b --- /dev/null +++ b/MultipleAccelerometer/Classes/MultipleAccelerometerViewController.m @@ -0,0 +1,65 @@ +// +// MultipleAccelerometerViewController.m +// MultipleAccelerometer +// +// Created by Andreas Katzian on 15.06.10. +// Copyright Blackwhale GmbH 2010. All rights reserved. +// + +#import "MultipleAccelerometerViewController.h" + +@implementation MultipleAccelerometerViewController + + + +/* +// 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 { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + + // Release any cached data, images, etc that aren't in use. +} + +- (void)viewDidUnload { + // Release any retained subviews of the main view. + // e.g. self.myOutlet = nil; +} + + +- (void)dealloc { + [super dealloc]; +} + +@end diff --git a/MultipleAccelerometer/Classes/ObserverOne.h b/MultipleAccelerometer/Classes/ObserverOne.h new file mode 100644 index 0000000..a1fe84c --- /dev/null +++ b/MultipleAccelerometer/Classes/ObserverOne.h @@ -0,0 +1,16 @@ +// +// ObserverOne.h +// MultipleAccelerometer +// +// Created by Andreas Katzian on 15.06.10. +// Copyright 2010 Blackwhale GmbH. All rights reserved. +// + +#import + + +@interface ObserverOne : NSObject { + +} + +@end diff --git a/MultipleAccelerometer/Classes/ObserverOne.m b/MultipleAccelerometer/Classes/ObserverOne.m new file mode 100644 index 0000000..dd8f33e --- /dev/null +++ b/MultipleAccelerometer/Classes/ObserverOne.m @@ -0,0 +1,23 @@ +// +// ObserverOne.m +// MultipleAccelerometer +// +// Created by Andreas Katzian on 15.06.10. +// Copyright 2010 Blackwhale GmbH. All rights reserved. +// + +#import "ObserverOne.h" + + +@implementation ObserverOne + +- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration +{ + NSLog(@"Observer one was notified about acceleration (x: %f y: %f z: %f).", + acceleration.x, + acceleration.y, + acceleration.z); +} + + +@end diff --git a/MultipleAccelerometer/Classes/ObserverTwo.h b/MultipleAccelerometer/Classes/ObserverTwo.h new file mode 100644 index 0000000..f2c82cf --- /dev/null +++ b/MultipleAccelerometer/Classes/ObserverTwo.h @@ -0,0 +1,16 @@ +// +// ObserverTwo.h +// MultipleAccelerometer +// +// Created by Andreas Katzian on 15.06.10. +// Copyright 2010 Blackwhale GmbH. All rights reserved. +// + +#import + + +@interface ObserverTwo : NSObject { + +} + +@end diff --git a/MultipleAccelerometer/Classes/ObserverTwo.m b/MultipleAccelerometer/Classes/ObserverTwo.m new file mode 100644 index 0000000..7526d66 --- /dev/null +++ b/MultipleAccelerometer/Classes/ObserverTwo.m @@ -0,0 +1,22 @@ +// +// ObserverTwo.m +// MultipleAccelerometer +// +// Created by Andreas Katzian on 15.06.10. +// Copyright 2010 Blackwhale GmbH. All rights reserved. +// + +#import "ObserverTwo.h" + + +@implementation ObserverTwo + +- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration +{ + NSLog(@"Observer two was notified about acceleration (x: %f y: %f z: %f).", + acceleration.x, + acceleration.y, + acceleration.z); +} + +@end diff --git a/MultipleAccelerometer/MainWindow.xib b/MultipleAccelerometer/MainWindow.xib new file mode 100644 index 0000000..5e10af4 --- /dev/null +++ b/MultipleAccelerometer/MainWindow.xib @@ -0,0 +1,444 @@ + + + + 1024 + 10D571 + 786 + 1038.29 + 460.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 112 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + IBCocoaTouchFramework + + + MultipleAccelerometerViewController + + + 1 + + IBCocoaTouchFramework + NO + + + + 292 + {320, 480} + + 1 + MSAxIDEAA + + NO + NO + + IBCocoaTouchFramework + YES + + + + + YES + + + delegate + + + + 4 + + + + viewController + + + + 11 + + + + window + + + + 14 + + + + + YES + + 0 + + + + + + -1 + + + File's Owner + + + 3 + + + MultipleAccelerometer App Delegate + + + -2 + + + + + 10 + + + + + 12 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 10.CustomClassName + 10.IBEditorWindowLastContentRect + 10.IBPluginDependency + 12.IBEditorWindowLastContentRect + 12.IBPluginDependency + 3.CustomClassName + 3.IBPluginDependency + + + YES + UIApplication + UIResponder + MultipleAccelerometerViewController + {{234, 376}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{525, 346}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + MultipleAccelerometerAppDelegate + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 15 + + + + YES + + UIWindow + UIView + + IBUserSource + + + + + MultipleAccelerometerAppDelegate + NSObject + + YES + + YES + viewController + window + + + YES + MultipleAccelerometerViewController + UIWindow + + + + YES + + YES + viewController + window + + + YES + + viewController + MultipleAccelerometerViewController + + + window + UIWindow + + + + + IBProjectSource + Classes/MultipleAccelerometerAppDelegate.h + + + + MultipleAccelerometerAppDelegate + NSObject + + IBUserSource + + + + + MultipleAccelerometerViewController + UIViewController + + IBProjectSource + Classes/MultipleAccelerometerViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIApplication + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIApplication.h + + + + UIResponder + NSObject + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + UIWindow + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIWindow.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + MultipleAccelerometer.xcodeproj + 3 + 112 + + diff --git a/MultipleAccelerometer/MultipleAccelerometer-Info.plist b/MultipleAccelerometer/MultipleAccelerometer-Info.plist new file mode 100644 index 0000000..23ec858 --- /dev/null +++ b/MultipleAccelerometer/MultipleAccelerometer-Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + at.blackwhale.EXAMPLE + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + NSMainNibFile + MainWindow + + diff --git a/MultipleAccelerometer/MultipleAccelerometer.xcodeproj/project.pbxproj b/MultipleAccelerometer/MultipleAccelerometer.xcodeproj/project.pbxproj new file mode 100755 index 0000000..2857ffe --- /dev/null +++ b/MultipleAccelerometer/MultipleAccelerometer.xcodeproj/project.pbxproj @@ -0,0 +1,273 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXBuildFile section */ + 1D3623260D0F684500981E51 /* MultipleAccelerometerAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* MultipleAccelerometerAppDelegate.m */; }; + 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; + 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; + 2899E5220DE3E06400AC0155 /* MultipleAccelerometerViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2899E5210DE3E06400AC0155 /* MultipleAccelerometerViewController.xib */; }; + 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; }; + 28D7ACF80DDB3853001CB0EB /* MultipleAccelerometerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* MultipleAccelerometerViewController.m */; }; + A9005A3811C81BC1005ABDD1 /* Accelerometer.m in Sources */ = {isa = PBXBuildFile; fileRef = A9005A3711C81BC1005ABDD1 /* Accelerometer.m */; }; + A9005A3E11C81BFC005ABDD1 /* ObserverOne.m in Sources */ = {isa = PBXBuildFile; fileRef = A9005A3D11C81BFC005ABDD1 /* ObserverOne.m */; }; + A9005A4111C81C05005ABDD1 /* ObserverTwo.m in Sources */ = {isa = PBXBuildFile; fileRef = A9005A4011C81C05005ABDD1 /* ObserverTwo.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 1D3623240D0F684500981E51 /* MultipleAccelerometerAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MultipleAccelerometerAppDelegate.h; sourceTree = ""; }; + 1D3623250D0F684500981E51 /* MultipleAccelerometerAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MultipleAccelerometerAppDelegate.m; sourceTree = ""; }; + 1D6058910D05DD3D006BFB54 /* MultipleAccelerometer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MultipleAccelerometer.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 /* MultipleAccelerometerViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MultipleAccelerometerViewController.xib; sourceTree = ""; }; + 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; + 28D7ACF60DDB3853001CB0EB /* MultipleAccelerometerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MultipleAccelerometerViewController.h; sourceTree = ""; }; + 28D7ACF70DDB3853001CB0EB /* MultipleAccelerometerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MultipleAccelerometerViewController.m; sourceTree = ""; }; + 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 32CA4F630368D1EE00C91783 /* MultipleAccelerometer_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MultipleAccelerometer_Prefix.pch; sourceTree = ""; }; + 8D1107310486CEB800E47090 /* MultipleAccelerometer-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "MultipleAccelerometer-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; + A9005A3611C81BC1005ABDD1 /* Accelerometer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Accelerometer.h; sourceTree = ""; }; + A9005A3711C81BC1005ABDD1 /* Accelerometer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Accelerometer.m; sourceTree = ""; }; + A9005A3C11C81BFC005ABDD1 /* ObserverOne.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObserverOne.h; sourceTree = ""; }; + A9005A3D11C81BFC005ABDD1 /* ObserverOne.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ObserverOne.m; sourceTree = ""; }; + A9005A3F11C81C05005ABDD1 /* ObserverTwo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObserverTwo.h; sourceTree = ""; }; + A9005A4011C81C05005ABDD1 /* ObserverTwo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ObserverTwo.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, + 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 080E96DDFE201D6D7F000001 /* Classes */ = { + isa = PBXGroup; + children = ( + A9005A3611C81BC1005ABDD1 /* Accelerometer.h */, + A9005A3711C81BC1005ABDD1 /* Accelerometer.m */, + 1D3623240D0F684500981E51 /* MultipleAccelerometerAppDelegate.h */, + 1D3623250D0F684500981E51 /* MultipleAccelerometerAppDelegate.m */, + 28D7ACF60DDB3853001CB0EB /* MultipleAccelerometerViewController.h */, + 28D7ACF70DDB3853001CB0EB /* MultipleAccelerometerViewController.m */, + A9005A3C11C81BFC005ABDD1 /* ObserverOne.h */, + A9005A3D11C81BFC005ABDD1 /* ObserverOne.m */, + A9005A3F11C81C05005ABDD1 /* ObserverTwo.h */, + A9005A4011C81C05005ABDD1 /* ObserverTwo.m */, + ); + path = Classes; + sourceTree = ""; + }; + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 1D6058910D05DD3D006BFB54 /* MultipleAccelerometer.app */, + ); + name = Products; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { + isa = PBXGroup; + children = ( + 080E96DDFE201D6D7F000001 /* Classes */, + 29B97315FDCFA39411CA2CEA /* Other Sources */, + 29B97317FDCFA39411CA2CEA /* Resources */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = CustomTemplate; + sourceTree = ""; + }; + 29B97315FDCFA39411CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + 32CA4F630368D1EE00C91783 /* MultipleAccelerometer_Prefix.pch */, + 29B97316FDCFA39411CA2CEA /* main.m */, + ); + name = "Other Sources"; + sourceTree = ""; + }; + 29B97317FDCFA39411CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + 2899E5210DE3E06400AC0155 /* MultipleAccelerometerViewController.xib */, + 28AD733E0D9D9553002E5188 /* MainWindow.xib */, + 8D1107310486CEB800E47090 /* MultipleAccelerometer-Info.plist */, + ); + name = Resources; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, + 1D30AB110D05D00D00671497 /* Foundation.framework */, + 288765A40DF7441C002DB57D /* CoreGraphics.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 1D6058900D05DD3D006BFB54 /* MultipleAccelerometer */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "MultipleAccelerometer" */; + buildPhases = ( + 1D60588D0D05DD3D006BFB54 /* Resources */, + 1D60588E0D05DD3D006BFB54 /* Sources */, + 1D60588F0D05DD3D006BFB54 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = MultipleAccelerometer; + productName = MultipleAccelerometer; + productReference = 1D6058910D05DD3D006BFB54 /* MultipleAccelerometer.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "MultipleAccelerometer" */; + compatibilityVersion = "Xcode 3.1"; + hasScannedForEncodings = 1; + mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 1D6058900D05DD3D006BFB54 /* MultipleAccelerometer */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 1D60588D0D05DD3D006BFB54 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */, + 2899E5220DE3E06400AC0155 /* MultipleAccelerometerViewController.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 1D60588E0D05DD3D006BFB54 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1D60589B0D05DD56006BFB54 /* main.m in Sources */, + 1D3623260D0F684500981E51 /* MultipleAccelerometerAppDelegate.m in Sources */, + 28D7ACF80DDB3853001CB0EB /* MultipleAccelerometerViewController.m in Sources */, + A9005A3811C81BC1005ABDD1 /* Accelerometer.m in Sources */, + A9005A3E11C81BFC005ABDD1 /* ObserverOne.m in Sources */, + A9005A4111C81C05005ABDD1 /* ObserverTwo.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1D6058940D05DD3E006BFB54 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Don't Code Sign"; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = MultipleAccelerometer_Prefix.pch; + INFOPLIST_FILE = "MultipleAccelerometer-Info.plist"; + PRODUCT_NAME = MultipleAccelerometer; + "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; + SDKROOT = iphoneos4.0; + }; + name = Debug; + }; + 1D6058950D05DD3E006BFB54 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = MultipleAccelerometer_Prefix.pch; + INFOPLIST_FILE = "MultipleAccelerometer-Info.plist"; + PRODUCT_NAME = MultipleAccelerometer; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 3.1; + PREBINDING = NO; + SDKROOT = iphoneos4.0; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + PREBINDING = NO; + SDKROOT = iphoneos4.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "MultipleAccelerometer" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1D6058940D05DD3E006BFB54 /* Debug */, + 1D6058950D05DD3E006BFB54 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "MultipleAccelerometer" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/MultipleAccelerometer/MultipleAccelerometerViewController.xib b/MultipleAccelerometer/MultipleAccelerometerViewController.xib new file mode 100644 index 0000000..c7eba9a --- /dev/null +++ b/MultipleAccelerometer/MultipleAccelerometerViewController.xib @@ -0,0 +1,156 @@ + + + + 800 + 10C540 + 759 + 1038.25 + 458.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 77 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + {320, 460} + + + 3 + MC43NQA + + 2 + + + NO + + IBCocoaTouchFramework + + + + + YES + + + view + + + + 7 + + + + + YES + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 6 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 6.IBEditorWindowLastContentRect + 6.IBPluginDependency + + + YES + MultipleAccelerometerViewController + UIResponder + {{239, 654}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 7 + + + + YES + + MultipleAccelerometerViewController + UIViewController + + IBProjectSource + Classes/MultipleAccelerometerViewController.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + MultipleAccelerometer.xcodeproj + 3 + 77 + + + diff --git a/MultipleAccelerometer/MultipleAccelerometer_Prefix.pch b/MultipleAccelerometer/MultipleAccelerometer_Prefix.pch new file mode 100644 index 0000000..a7d13a9 --- /dev/null +++ b/MultipleAccelerometer/MultipleAccelerometer_Prefix.pch @@ -0,0 +1,8 @@ +// +// Prefix header for all source files of the 'MultipleAccelerometer' target in the 'MultipleAccelerometer' project +// + +#ifdef __OBJC__ + #import + #import +#endif diff --git a/MultipleAccelerometer/main.m b/MultipleAccelerometer/main.m new file mode 100644 index 0000000..0c5c537 --- /dev/null +++ b/MultipleAccelerometer/main.m @@ -0,0 +1,17 @@ +// +// main.m +// MultipleAccelerometer +// +// Created by Andreas Katzian on 15.06.10. +// Copyright Blackwhale GmbH 2010. All rights reserved. +// + +#import + +int main(int argc, char *argv[]) { + + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + int retVal = UIApplicationMain(argc, argv, nil, nil); + [pool release]; + return retVal; +} diff --git a/README.textile b/README.textile index 6e86326..6f20cf5 100644 --- a/README.textile +++ b/README.textile @@ -7,4 +7,5 @@ p. # *CameraOverlay* - This example shows how to display a custom view within the iPhone camera view. You will see how to display the view containing an image and a button. # *MasterDetail* - This is a simple iPad application example, which shows you how to create your own master-detail view using the UISplitViewController. The code also includes some modifications to choose whether to show the master view in full size or as a popup within portrait mode. # *PopoverView* - How to create a custom popover view and how to add content programmatically or by the use of Interface Builder will be shown in this very basic example. Also positioning of the popover view is content of this example. +# *MultipleAccelerometer* - This project includes a very basic implementation to enable multiple delegates to receive acceleration events from the device.