diff --git a/SSToolkit.xcodeproj/project.pbxproj b/SSToolkit.xcodeproj/project.pbxproj index 24f7237..788e4df 100644 --- a/SSToolkit.xcodeproj/project.pbxproj +++ b/SSToolkit.xcodeproj/project.pbxproj @@ -14,8 +14,6 @@ 956E83D01332C5BF00C7E252 /* SSInnerWebView.h in Headers */ = {isa = PBXBuildFile; fileRef = 956E83CE1332C5BF00C7E252 /* SSInnerWebView.h */; settings = {ATTRIBUTES = (Public, ); }; }; 956E83D11332C5BF00C7E252 /* SSInnerWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = 956E83CF1332C5BF00C7E252 /* SSInnerWebView.m */; }; AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; }; - B207C63712EA209100412418 /* SSWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = B207C63512EA209100412418 /* SSWindow.h */; settings = {ATTRIBUTES = (Public, ); }; }; - B207C63812EA209100412418 /* SSWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = B207C63612EA209100412418 /* SSWindow.m */; }; B20AC0691267988600687143 /* SSTableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = B20AC0671267988600687143 /* SSTableViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; B20AC06A1267988600687143 /* SSTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B20AC0681267988600687143 /* SSTableViewController.m */; }; B215045F10583A7300409ED4 /* SSToolkit_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = B215045E10583A7300409ED4 /* SSToolkit_Prefix.pch */; }; @@ -120,8 +118,6 @@ 956E83CE1332C5BF00C7E252 /* SSInnerWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSInnerWebView.h; sourceTree = ""; }; 956E83CF1332C5BF00C7E252 /* SSInnerWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSInnerWebView.m; sourceTree = ""; }; AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - B207C63512EA209100412418 /* SSWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSWindow.h; sourceTree = ""; }; - B207C63612EA209100412418 /* SSWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSWindow.m; sourceTree = ""; }; B20AC0671267988600687143 /* SSTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSTableViewController.h; sourceTree = ""; }; B20AC0681267988600687143 /* SSTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSTableViewController.m; sourceTree = ""; }; B215045E10583A7300409ED4 /* SSToolkit_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSToolkit_Prefix.pch; sourceTree = ""; }; @@ -376,8 +372,6 @@ B24E9E2B121DC29A0085F81E /* SSPieProgressView.m */, B24E9E33121DC29A0085F81E /* SSWebView.h */, B24E9E34121DC29A0085F81E /* SSWebView.m */, - B207C63512EA209100412418 /* SSWindow.h */, - B207C63612EA209100412418 /* SSWindow.m */, 956E83CE1332C5BF00C7E252 /* SSInnerWebView.h */, 956E83CF1332C5BF00C7E252 /* SSInnerWebView.m */, ); @@ -502,7 +496,6 @@ B2AE1134126F963300534CF2 /* UIApplication+SSToolkitAdditions.h in Headers */, B2AAE65C1281B73E0068EE7F /* SSNavigationController.h in Headers */, B2B3CED81296F637001BAC94 /* SSSwitch.h in Headers */, - B207C63712EA209100412418 /* SSWindow.h in Headers */, B2EA9F5E12F4A5C900C929D6 /* SSBadgeTableViewCell.h in Headers */, B2EA9F6212F4A5E100C929D6 /* SSBadgeView.h in Headers */, B28218BE12FA6AE100BAF3C6 /* SSToolkitDefines.h in Headers */, @@ -608,7 +601,6 @@ B2AE1135126F963300534CF2 /* UIApplication+SSToolkitAdditions.m in Sources */, B2AAE65D1281B73E0068EE7F /* SSNavigationController.m in Sources */, B2B3CED91296F637001BAC94 /* SSSwitch.m in Sources */, - B207C63812EA209100412418 /* SSWindow.m in Sources */, B2EA9F5F12F4A5C900C929D6 /* SSBadgeTableViewCell.m in Sources */, B2EA9F6312F4A5E100C929D6 /* SSBadgeView.m in Sources */, B28218BF12FA6AE100BAF3C6 /* SSToolkitDefines.m in Sources */, diff --git a/SSToolkit/SSToolkit.h b/SSToolkit/SSToolkit.h index b1ac466..976d627 100644 --- a/SSToolkit/SSToolkit.h +++ b/SSToolkit/SSToolkit.h @@ -23,7 +23,6 @@ #import "SSLoadingView.h" #import "SSPieProgressView.h" #import "SSWebView.h" -#import "SSWindow.h" // Cells #import "SSBadgeTableViewCell.h" @@ -62,7 +61,6 @@ #import #import #import -#import // Cells #import b diff --git a/SSToolkit/SSWindow.h b/SSToolkit/SSWindow.h deleted file mode 100644 index 161e99a..0000000 --- a/SSToolkit/SSWindow.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// SSWindow.h -// SSToolkit -// -// Created by Sam Soffes on 1/21/11. -// Copyright 2011 Sam Soffes. All rights reserved. -// - -@protocol SSWindowObserver; - -@interface SSWindow : UIWindow { - - NSMutableDictionary *_storage; -} - -- (void)setObserver:(id)observer forView:(UIView *)view; -- (void)removeObserver:(id)observer; -- (void)removeObserverForView:(UIView *)view; - -@end - - -@protocol SSWindowObserver - -- (void)windowViewWasTouched:(UIView *)aView atPoint:(CGPoint)point; - -@end diff --git a/SSToolkit/SSWindow.m b/SSToolkit/SSWindow.m deleted file mode 100644 index 865e679..0000000 --- a/SSToolkit/SSWindow.m +++ /dev/null @@ -1,124 +0,0 @@ -// -// SSWindow.m -// SSToolkit -// -// Created by Sam Soffes on 1/21/11. -// Copyright 2011 Sam Soffes. All rights reserved. -// - -#import "SSWindow.h" - -@interface SSWindow (PrivateMethods) -- (void)_processEvent:(UIEvent *)event forView:(UIView *)view; -- (void)_forwardTap:(NSDictionary *)info; -- (NSMutableDictionary *)_storage; -@end - - -@implementation SSWindow - -#pragma mark NSObject - -- (id)init { - self = [super initWithFrame:[[UIScreen mainScreen] bounds]]; - return self; -} - - -- (void)dealloc { - [_storage release]; - [super dealloc]; -} - - -#pragma mark UIWindow - -- (void)sendEvent:(UIEvent *)event { - [super sendEvent:event]; - - if ([[self _storage] count] == 0) { - return; - } - - NSSet *touches = [event allTouches]; - if (touches.count != 1) { - return; - } - - UITouch *touch = touches.anyObject; - if (touch.phase != UITouchPhaseEnded) { - return; - } - - for (NSValue *value in [self _storage]) { - UIView *view = [value pointerValue]; - if ([touch.view isDescendantOfView:view]) { - [self _processEvent:event forView:view]; - } - } -} - - -#pragma mark Storage - -- (void)setObserver:(id)observer forView:(UIView *)view { - if ([[self _storage] objectForKey:[NSValue valueWithPointer:view]] == observer) { - return; - } - - [[self _storage] setObject:observer forKey:[NSValue valueWithPointer:view]]; -} - - -- (void)removeObserver:(id)observer { - for (NSValue *view in [self _storage]) { - if ([[self _storage] objectForKey:view] == observer) { - [[self _storage] removeObjectForKey:view]; - } - } -} - - -- (void)removeObserverForView:(UIView *)view { - [[self _storage] removeObjectForKey:[NSValue valueWithPointer:view]]; -} - - -#pragma mark Private Methods - -- (void)_processEvent:(UIEvent *)event forView:(UIView *)view { - UITouch *touch = [[event allTouches] anyObject]; - CGPoint tapPoint = [touch locationInView:view]; - NSValue *pointValue = [NSValue valueWithCGPoint:tapPoint]; - NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys: - pointValue, @"point", - view, @"view", - nil]; - - if (touch.tapCount == 1) { - [self performSelector:@selector(_forwardTap:) withObject:info afterDelay:0.1]; - } else if (touch.tapCount > 1) { - [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(_forwardTap:) object:info]; - } -} - - -- (void)_forwardTap:(NSDictionary *)info { - UIView *view = [info objectForKey:@"view"]; - id observer = [[self _storage] objectForKey:[NSValue valueWithPointer:view]]; - - if ([observer respondsToSelector:@selector(windowViewWasTouched:atPoint:)]) { - CGPoint point = [[info objectForKey:@"point"] CGPointValue]; - [observer windowViewWasTouched:view atPoint:point]; - } -} - - -- (NSMutableDictionary *)_storage { - if (!_storage) { - _storage = [[NSMutableDictionary alloc] init]; - } - return _storage; -} - -@end