diff --git a/.clang-format b/.clang-format index 6ac1f0a..65982da 100644 --- a/.clang-format +++ b/.clang-format @@ -1,65 +1,55 @@ -Language: Cpp +--- +Language: Cpp +# BasedOnStyle: WebKit AccessModifierOffset: -4 - +ConstructorInitializerIndentWidth: 4 AlignEscapedNewlinesLeft: false AlignTrailingComments: false -PointerAlignment: Left - AllowAllParametersOfDeclarationOnNextLine: true -AllowShortBlocksOnASingleLine: true -AllowShortIfStatementsOnASingleLine: true -AllowShortLoopsOnASingleLine: true +AllowShortBlocksOnASingleLine: false +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false AllowShortFunctionsOnASingleLine: All - AlwaysBreakTemplateDeclarations: false AlwaysBreakBeforeMultilineStrings: false -# Only available on clang-format 3.6 -# AlwaysBreakAfterDefinitionReturnType: true -BreakBeforeBinaryOperators: false +BreakBeforeBinaryOperators: true BreakBeforeTernaryOperators: true BreakConstructorInitializersBeforeComma: true -BreakBeforeBraces: Attach - BinPackParameters: true -ColumnLimit: 0 +ColumnLimit: 0 ConstructorInitializerAllOnOneLineOrOnePerLine: false -DerivePointerAlignment: false +DerivePointerBinding: false ExperimentalAutoDetectBinPacking: false IndentCaseLabels: true -IndentWrappedFunctionNames: false -IndentFunctionDeclarationAfterType: false MaxEmptyLinesToKeep: 1 KeepEmptyLinesAtTheStartOfBlocks: true +NamespaceIndentation: Inner ObjCSpaceAfterProperty: true ObjCSpaceBeforeProtocolList: true - PenaltyBreakBeforeFirstCallParameter: 19 PenaltyBreakComment: 300 PenaltyBreakString: 1000 PenaltyBreakFirstLessLess: 120 PenaltyExcessCharacter: 1000000 PenaltyReturnTypeOnItsOwnLine: 60 - +PointerBindsToType: false +SpacesBeforeTrailingComments: 1 Cpp11BracedListStyle: false -Standard: Cpp03 - -TabWidth: 8 -UseTab: Never -NamespaceIndentation: Inner -IndentWidth: 4 -ConstructorInitializerIndentWidth: 4 -ContinuationIndentWidth: 4 - +Standard: Cpp03 +IndentWidth: 4 +TabWidth: 8 +UseTab: Never +BreakBeforeBraces: Attach +IndentFunctionDeclarationAfterType: false SpacesInParentheses: false -SpacesInAngles: false +SpacesInAngles: false SpaceInEmptyParentheses: false SpacesInCStyleCastParentheses: false SpacesInContainerLiterals: true SpaceBeforeAssignmentOperators: true -SpacesBeforeTrailingComments: 1 +ContinuationIndentWidth: 4 +CommentPragmas: '^ IWYU pragma:' +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] SpaceBeforeParens: ControlStatements - -CommentPragmas: '^ IWYU pragma:' -ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] -DisableFormat: false +DisableFormat: false ... diff --git a/COSTouchVisualizer.podspec b/COSTouchVisualizer.podspec index c4d210e..8e30da2 100644 --- a/COSTouchVisualizer.podspec +++ b/COSTouchVisualizer.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "COSTouchVisualizer" - s.version = "1.0.5" + s.version = "1.0.6" s.summary = "Visualize iOS finger touches, gestures and holds on external displays" s.description = <<-DESC Touch Screen Visualizer visualizes your touches, gestures, and holds on diff --git a/Classes/COSTouchVisualizerWindow.h b/Classes/COSTouchVisualizerWindow.h index 4d57350..a216590 100755 --- a/Classes/COSTouchVisualizerWindow.h +++ b/Classes/COSTouchVisualizerWindow.h @@ -15,18 +15,18 @@ @property (nonatomic, weak) id touchVisualizerWindowDelegate; // Touch effects -@property (nonatomic) UIImage* touchImage; +@property (nonatomic) UIImage *touchImage; @property (nonatomic) CGFloat touchAlpha; @property (nonatomic) NSTimeInterval fadeDuration; -@property (nonatomic) UIColor* strokeColor; -@property (nonatomic) UIColor* fillColor; +@property (nonatomic) UIColor *strokeColor; +@property (nonatomic) UIColor *fillColor; // Ripple Effects -@property (nonatomic) UIImage* rippleImage; +@property (nonatomic) UIImage *rippleImage; @property (nonatomic) CGFloat rippleAlpha; @property (nonatomic) NSTimeInterval rippleFadeDuration; -@property (nonatomic) UIColor* rippleStrokeColor; -@property (nonatomic) UIColor* rippleFillColor; +@property (nonatomic) UIColor *rippleStrokeColor; +@property (nonatomic) UIColor *rippleFillColor; @property (nonatomic) BOOL stationaryMorphEnabled; // default: YES @@ -36,7 +36,7 @@ @optional -- (BOOL)touchVisualizerWindowShouldShowFingertip:(COSTouchVisualizerWindow*)window; -- (BOOL)touchVisualizerWindowShouldAlwaysShowFingertip:(COSTouchVisualizerWindow*)window; +- (BOOL)touchVisualizerWindowShouldShowFingertip:(COSTouchVisualizerWindow *)window; +- (BOOL)touchVisualizerWindowShouldAlwaysShowFingertip:(COSTouchVisualizerWindow *)window; @end diff --git a/Classes/COSTouchVisualizerWindow.m b/Classes/COSTouchVisualizerWindow.m index b0c0c10..9664716 100755 --- a/Classes/COSTouchVisualizerWindow.m +++ b/Classes/COSTouchVisualizerWindow.m @@ -8,6 +8,31 @@ #import "COSTouchVisualizerWindow.h" +#pragma mark - Touch Visualizer Window + +@interface TouchVisualizerWindow : UIWindow +@end + +@implementation TouchVisualizerWindow + +// UIKit tries to get the rootViewController from the overlay window. +// Instead, try to find the rootViewController on some other +// application window. +// Fixes problems with status bar hiding, because it considers the +// overlay window a candidate for controlling the status bar. +- (UIViewController *)rootViewController { + for (UIWindow *window in [[UIApplication sharedApplication] windows]) { + if (self == window) + continue; + UIViewController *realRootViewController = window.rootViewController; + if (realRootViewController != nil) + return realRootViewController; + } + return [super rootViewController]; +} + +@end + #pragma mark - Conopsys Touch Spot View @interface COSTouchSpotView : UIImageView @@ -21,40 +46,28 @@ @implementation COSTouchSpotView @end -#pragma mark - Conopsys Touch Overlay Window View Controller - -@interface COSTouchOverlayWindowViewController : UIViewController -@end - -@implementation COSTouchOverlayWindowViewController - -- (UIStatusBarStyle)preferredStatusBarStyle { - return [UIApplication sharedApplication].keyWindow.rootViewController.preferredStatusBarStyle; -} - -@end - #pragma mark - Conopsys Touch Visualizer Window @interface COSTouchVisualizerWindow () -@property (nonatomic) UIWindow* overlayWindow; -@property (nonatomic) UIViewController* overlayWindowViewController; +@property (nonatomic) UIWindow *overlayWindow; +@property (nonatomic) UIViewController *overlayWindowViewController; @property (nonatomic) BOOL fingerTipRemovalScheduled; -@property (nonatomic) NSTimer* timer; +@property (nonatomic) NSTimer *timer; +@property (nonatomic) NSSet *allTouches; - (void)COSTouchVisualizerWindow_commonInit; - (void)scheduleFingerTipRemoval; - (void)cancelScheduledFingerTipRemoval; - (void)removeInactiveFingerTips; - (void)removeFingerTipWithHash:(NSUInteger)hash animated:(BOOL)animated; -- (BOOL)shouldAutomaticallyRemoveFingerTipForTouch:(UITouch*)touch; +- (BOOL)shouldAutomaticallyRemoveFingerTipForTouch:(UITouch *)touch; @end @implementation COSTouchVisualizerWindow -- (id)initWithCoder:(NSCoder*)decoder { +- (id)initWithCoder:(NSCoder *)decoder { // This covers NIB-loaded windows. if (self = [super initWithCoder:decoder]) [self COSTouchVisualizerWindow_commonInit]; @@ -80,15 +93,15 @@ self.stationaryMorphEnabled = YES; } -#pragma mark - +#pragma mark - Touch / Ripple and Images -- (UIImage*)touchImage { +- (UIImage *)touchImage { if (!_touchImage) { - UIBezierPath* clipPath = [UIBezierPath bezierPathWithRect:CGRectMake(0, 0, 50.0, 50.0)]; + UIBezierPath *clipPath = [UIBezierPath bezierPathWithRect:CGRectMake(0, 0, 50.0, 50.0)]; UIGraphicsBeginImageContextWithOptions(clipPath.bounds.size, NO, 0); - UIBezierPath* drawPath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(25.0, 25.0) + UIBezierPath *drawPath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(25.0, 25.0) radius:22.0 startAngle:0 endAngle:2 * M_PI @@ -110,13 +123,13 @@ return _touchImage; } -- (UIImage*)rippleImage { +- (UIImage *)rippleImage { if (!_rippleImage) { - UIBezierPath* clipPath = [UIBezierPath bezierPathWithRect:CGRectMake(0, 0, 50.0, 50.0)]; + UIBezierPath *clipPath = [UIBezierPath bezierPathWithRect:CGRectMake(0, 0, 50.0, 50.0)]; UIGraphicsBeginImageContextWithOptions(clipPath.bounds.size, NO, 0); - UIBezierPath* drawPath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(25.0, 25.0) + UIBezierPath *drawPath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(25.0, 25.0) radius:22.0 startAngle:0 endAngle:2 * M_PI @@ -138,13 +151,13 @@ return _rippleImage; } -#pragma mark Active +#pragma mark - Active - (BOOL)anyScreenIsMirrored { if (![UIScreen instancesRespondToSelector:@selector(mirroredScreen)]) return NO; - for (UIScreen* screen in [UIScreen screens]) { + for (UIScreen *screen in [UIScreen screens]) { if ([screen mirroredScreen] != nil) { return YES; } @@ -165,17 +178,17 @@ } } -#pragma mark UIWindow overrides +#pragma mark - UIWindow overrides -- (void)sendEvent:(UIEvent*)event { +- (void)sendEvent:(UIEvent *)event { if (self.active) { - NSSet* allTouches = [event allTouches]; - for (UITouch* touch in [allTouches allObjects]) { + self.allTouches = [event allTouches]; + for (UITouch *touch in [self.allTouches allObjects]) { switch (touch.phase) { case UITouchPhaseBegan: case UITouchPhaseMoved: { // Generate ripples - COSTouchSpotView* rippleView = [[COSTouchSpotView alloc] initWithImage:self.rippleImage]; + COSTouchSpotView *rippleView = [[COSTouchSpotView alloc] initWithImage:self.rippleImage]; [self.overlayWindow addSubview:rippleView]; rippleView.alpha = self.rippleAlpha; @@ -186,19 +199,16 @@ options:UIViewAnimationOptionCurveEaseIn // See other // options animations:^{ - [rippleView setAlpha:0.0]; - [rippleView setFrame:CGRectInset(rippleView.frame, 25, 25)]; - } - completion:^(BOOL finished) { - [rippleView removeFromSuperview]; + [rippleView setAlpha:0.0]; + [rippleView setFrame:CGRectInset(rippleView.frame, 25, 25)]; + } completion:^(BOOL finished) { + [rippleView removeFromSuperview]; }]; } case UITouchPhaseStationary: { - COSTouchSpotView* touchView = (COSTouchSpotView*) - [self.overlayWindow viewWithTag:touch.hash]; + COSTouchSpotView *touchView = (COSTouchSpotView *)[self.overlayWindow viewWithTag:touch.hash]; - if (touch.phase != UITouchPhaseStationary && touchView != nil && - [touchView isFadingOut]) { + if (touch.phase != UITouchPhaseStationary && touchView != nil && [touchView isFadingOut]) { [self.timer invalidate]; [touchView removeFromSuperview]; touchView = nil; @@ -235,32 +245,24 @@ } [super sendEvent:event]; - - [self scheduleFingerTipRemoval]; // We may not see all - // UITouchPhaseEnded/UITouchPhaseCancelled - // events. + [self scheduleFingerTipRemoval]; // We may not see all UITouchPhaseEnded/UITouchPhaseCancelled events. } -#pragma mark - -#pragma mark Private +#pragma mark - Private -- (UIWindow*)overlayWindow { +- (UIWindow *)overlayWindow { if (!_overlayWindow) { - _overlayWindow = [[UIWindow alloc] initWithFrame:self.frame]; + _overlayWindow = [[TouchVisualizerWindow alloc] initWithFrame:self.frame]; _overlayWindow.userInteractionEnabled = NO; _overlayWindow.windowLevel = UIWindowLevelStatusBar; _overlayWindow.backgroundColor = [UIColor clearColor]; _overlayWindow.hidden = NO; - - _overlayWindowViewController = [[COSTouchOverlayWindowViewController alloc] init]; - [_overlayWindow setRootViewController:_overlayWindowViewController]; - [_overlayWindowViewController setView:_overlayWindow]; } - return _overlayWindow; } - (void)scheduleFingerTipRemoval { + if (self.fingerTipRemovalScheduled) return; self.fingerTipRemovalScheduled = YES; @@ -281,22 +283,25 @@ NSTimeInterval now = [[NSProcessInfo processInfo] systemUptime]; const CGFloat REMOVAL_DELAY = 0.2; - - for (COSTouchSpotView* touchView in [self.overlayWindow subviews]) { - if (![touchView isKindOfClass:[COSTouchSpotView class]]) continue; + for (COSTouchSpotView *touchView in [self.overlayWindow subviews]) { + if (![touchView isKindOfClass:[COSTouchSpotView class]]) + continue; if (touchView.shouldAutomaticallyRemoveAfterTimeout && now > touchView.timestamp + REMOVAL_DELAY) [self removeFingerTipWithHash:touchView.tag animated:YES]; } - if ([[self.overlayWindow subviews] count]) [self scheduleFingerTipRemoval]; + if ([[self.overlayWindow subviews] count]) + [self scheduleFingerTipRemoval]; } - (void)removeFingerTipWithHash:(NSUInteger)hash animated:(BOOL)animated { - COSTouchSpotView* touchView = (COSTouchSpotView*)[self.overlayWindow viewWithTag:hash]; - if (touchView == nil) return; + COSTouchSpotView *touchView = (COSTouchSpotView *)[self.overlayWindow viewWithTag:hash]; + if (touchView == nil) + return; - if ([touchView isFadingOut]) return; + if ([touchView isFadingOut]) + return; BOOL animationsWereEnabled = [UIView areAnimationsEnabled]; @@ -323,7 +328,7 @@ afterDelay:self.fadeDuration]; } -- (BOOL)shouldAutomaticallyRemoveFingerTipForTouch:(UITouch*)touch; +- (BOOL)shouldAutomaticallyRemoveFingerTipForTouch:(UITouch *)touch; { // We don't reliably get UITouchPhaseEnded or UITouchPhaseCancelled // events via -sendEvent: for certain touch events. Known cases @@ -337,18 +342,20 @@ // don't use UITouchPhaseStationary touches for those. *sigh*). So we // end up with this more complicated setup. - UIView* view = [touch view]; + UIView *view = [touch view]; view = [view hitTest:[touch locationInView:view] withEvent:nil]; while (view != nil) { if ([view isKindOfClass:[UITableViewCell class]]) { - for (UIGestureRecognizer* recognizer in [touch gestureRecognizers]) { - if ([recognizer isKindOfClass:[UISwipeGestureRecognizer class]]) return YES; + for (UIGestureRecognizer *recognizer in [touch gestureRecognizers]) { + if ([recognizer isKindOfClass:[UISwipeGestureRecognizer class]]) + return YES; } } if ([view isKindOfClass:[UITableView class]]) { - if ([[touch gestureRecognizers] count] == 0) return YES; + if ([[touch gestureRecognizers] count] == 0) + return YES; } view = view.superview; } @@ -356,8 +363,8 @@ return NO; } -- (void)performMorph:(NSTimer*)theTimer { - UIView* view = (UIView*)[theTimer userInfo]; +- (void)performMorph:(NSTimer *)theTimer { + UIView *view = (UIView *)[theTimer userInfo]; NSTimeInterval duration = .4; NSTimeInterval delay = 0; // Start @@ -395,11 +402,13 @@ view.transform = CGAffineTransformMakeScale(1, 1); } completion:^(BOOL finished){ - + // If there are no touches, remove this morping touch + if (self.allTouches.count == 0) + [view removeFromSuperview]; }]; }]; }]; }]; } -@end +@end \ No newline at end of file diff --git a/Example/TouchVisualizer.xcodeproj/project.pbxproj b/Example/TouchVisualizer.xcodeproj/project.pbxproj index 3d5d820..a601443 100644 --- a/Example/TouchVisualizer.xcodeproj/project.pbxproj +++ b/Example/TouchVisualizer.xcodeproj/project.pbxproj @@ -8,13 +8,14 @@ /* Begin PBXBuildFile section */ 530F5A797A9D4A7BB1CB3265 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 49B1CBA208334F3CBDDFFFE4 /* libPods.a */; }; + E670B46A1AB3EBEF0043E508 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E670B4691AB3EBEF0043E508 /* Main.storyboard */; }; + E670B46C1AB3EC8E0043E508 /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = E670B46B1AB3EC8E0043E508 /* Launch Screen.xib */; }; E6F67FCD18DE12B4001C954A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E6F67FCC18DE12B4001C954A /* Foundation.framework */; }; E6F67FCF18DE12B4001C954A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E6F67FCE18DE12B4001C954A /* CoreGraphics.framework */; }; E6F67FD118DE12B4001C954A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E6F67FD018DE12B4001C954A /* UIKit.framework */; }; E6F67FD718DE12B4001C954A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = E6F67FD518DE12B4001C954A /* InfoPlist.strings */; }; E6F67FD918DE12B4001C954A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E6F67FD818DE12B4001C954A /* main.m */; }; E6F67FDD18DE12B4001C954A /* COSAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E6F67FDC18DE12B4001C954A /* COSAppDelegate.m */; }; - E6F67FE018DE12B4001C954A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E6F67FDE18DE12B4001C954A /* Main.storyboard */; }; E6F67FE318DE12B4001C954A /* COSMasterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E6F67FE218DE12B4001C954A /* COSMasterViewController.m */; }; E6F67FE618DE12B4001C954A /* COSDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E6F67FE518DE12B4001C954A /* COSDetailViewController.m */; }; E6F67FE818DE12B4001C954A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E6F67FE718DE12B4001C954A /* Images.xcassets */; }; @@ -38,6 +39,8 @@ /* Begin PBXFileReference section */ 49B1CBA208334F3CBDDFFFE4 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 4AF719864DF9411488359337 /* Pods.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.xcconfig; path = Pods/Pods.xcconfig; sourceTree = ""; }; + E670B4691AB3EBEF0043E508 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; + E670B46B1AB3EC8E0043E508 /* Launch Screen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "Launch Screen.xib"; sourceTree = ""; }; E6F67FC918DE12B4001C954A /* TouchVisualizer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TouchVisualizer.app; sourceTree = BUILT_PRODUCTS_DIR; }; E6F67FCC18DE12B4001C954A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; E6F67FCE18DE12B4001C954A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; @@ -48,7 +51,6 @@ E6F67FDA18DE12B4001C954A /* TouchVisualizer-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TouchVisualizer-Prefix.pch"; sourceTree = ""; }; E6F67FDB18DE12B4001C954A /* COSAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = COSAppDelegate.h; sourceTree = ""; }; E6F67FDC18DE12B4001C954A /* COSAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = COSAppDelegate.m; sourceTree = ""; }; - E6F67FDF18DE12B4001C954A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; E6F67FE118DE12B4001C954A /* COSMasterViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = COSMasterViewController.h; sourceTree = ""; }; E6F67FE218DE12B4001C954A /* COSMasterViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = COSMasterViewController.m; sourceTree = ""; }; E6F67FE418DE12B4001C954A /* COSDetailViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = COSDetailViewController.h; sourceTree = ""; }; @@ -127,12 +129,13 @@ children = ( E6F67FDB18DE12B4001C954A /* COSAppDelegate.h */, E6F67FDC18DE12B4001C954A /* COSAppDelegate.m */, - E6F67FDE18DE12B4001C954A /* Main.storyboard */, + E670B4691AB3EBEF0043E508 /* Main.storyboard */, E6F67FE118DE12B4001C954A /* COSMasterViewController.h */, E6F67FE218DE12B4001C954A /* COSMasterViewController.m */, E6F67FE418DE12B4001C954A /* COSDetailViewController.h */, E6F67FE518DE12B4001C954A /* COSDetailViewController.m */, E6F67FE718DE12B4001C954A /* Images.xcassets */, + E670B46B1AB3EC8E0043E508 /* Launch Screen.xib */, E6F67FD318DE12B4001C954A /* Supporting Files */, ); path = TouchVisualizer; @@ -247,8 +250,9 @@ buildActionMask = 2147483647; files = ( E6F67FE818DE12B4001C954A /* Images.xcassets in Resources */, + E670B46C1AB3EC8E0043E508 /* Launch Screen.xib in Resources */, E6F67FD718DE12B4001C954A /* InfoPlist.strings in Resources */, - E6F67FE018DE12B4001C954A /* Main.storyboard in Resources */, + E670B46A1AB3EBEF0043E508 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -334,14 +338,6 @@ name = InfoPlist.strings; sourceTree = ""; }; - E6F67FDE18DE12B4001C954A /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - E6F67FDF18DE12B4001C954A /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; E6F67FF718DE12B4001C954A /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( diff --git a/Example/TouchVisualizer/Base.lproj/Main.storyboard b/Example/TouchVisualizer/Base.lproj/Main.storyboard deleted file mode 100644 index fe9bc62..0000000 --- a/Example/TouchVisualizer/Base.lproj/Main.storyboard +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Example/TouchVisualizer/COSAppDelegate.h b/Example/TouchVisualizer/COSAppDelegate.h index a32ae35..344a9a3 100644 --- a/Example/TouchVisualizer/COSAppDelegate.h +++ b/Example/TouchVisualizer/COSAppDelegate.h @@ -8,6 +8,6 @@ @interface COSAppDelegate : UIResponder -@property (nonatomic) UIWindow* window; +@property (nonatomic) UIWindow *window; @end diff --git a/Example/TouchVisualizer/COSAppDelegate.m b/Example/TouchVisualizer/COSAppDelegate.m index 0f57913..32bf530 100644 --- a/Example/TouchVisualizer/COSAppDelegate.m +++ b/Example/TouchVisualizer/COSAppDelegate.m @@ -14,28 +14,28 @@ @implementation COSAppDelegate -- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. return YES; } -- (COSTouchVisualizerWindow*)window { - static COSTouchVisualizerWindow* customWindow = nil; +- (COSTouchVisualizerWindow *)window { + static COSTouchVisualizerWindow *customWindow = nil; if (!customWindow) { customWindow = [[COSTouchVisualizerWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - [customWindow setFillColor:[UIColor yellowColor]]; - [customWindow setStrokeColor:[UIColor purpleColor]]; + [customWindow setFillColor:[UIColor purpleColor]]; + [customWindow setStrokeColor:[UIColor blueColor]]; [customWindow setTouchAlpha:0.4]; - [customWindow setRippleFillColor:[UIColor yellowColor]]; - [customWindow setRippleStrokeColor:[UIColor purpleColor]]; + [customWindow setRippleFillColor:[UIColor purpleColor]]; + [customWindow setRippleStrokeColor:[UIColor blueColor]]; [customWindow setRippleAlpha:0.1]; [customWindow setTouchVisualizerWindowDelegate:self]; } return customWindow; } -- (BOOL)touchVisualizerWindowShouldAlwaysShowFingertip:(COSTouchVisualizerWindow*)window { +- (BOOL)touchVisualizerWindowShouldAlwaysShowFingertip:(COSTouchVisualizerWindow *)window { return YES; } diff --git a/Example/TouchVisualizer/COSDetailViewController.m b/Example/TouchVisualizer/COSDetailViewController.m index cfb494d..6eca6b3 100644 --- a/Example/TouchVisualizer/COSDetailViewController.m +++ b/Example/TouchVisualizer/COSDetailViewController.m @@ -9,6 +9,7 @@ #import "COSDetailViewController.h" @interface COSDetailViewController () +@property (weak, nonatomic) IBOutlet UILabel *holding; - (void)configureView; @end @@ -23,11 +24,24 @@ } } +- (IBAction)toggleStatusBar:(UIButton *)sender { + [[UIApplication sharedApplication] setStatusBarHidden:![UIApplication sharedApplication].statusBarHidden withAnimation:UIStatusBarAnimationSlide]; +} + +- (IBAction)startHoldAction:(UIButton *)sender { + self.holding.text = @"Pressed"; + self.holding.textColor = [UIColor blackColor]; +} + +- (IBAction)releaseHoldAction:(UIButton *)sender { + self.holding.text = @"Not Pressed"; + self.holding.textColor = [UIColor lightGrayColor]; +} + - (void)configureView { // Update the user interface for the detail item. - if (self.detailItem) { + if (self.detailItem) self.detailDescriptionLabel.text = [self.detailItem description]; - } } - (void)viewDidLoad { diff --git a/Example/TouchVisualizer/COSMasterViewController.m b/Example/TouchVisualizer/COSMasterViewController.m index 6fd1f53..b863755 100644 --- a/Example/TouchVisualizer/COSMasterViewController.m +++ b/Example/TouchVisualizer/COSMasterViewController.m @@ -10,7 +10,7 @@ #import "COSDetailViewController.h" @interface COSMasterViewController () { - NSMutableArray* _objects; + NSMutableArray *_objects; } @end @@ -21,7 +21,7 @@ // Do any additional setup after loading the view, typically from a nib. self.navigationItem.leftBarButtonItem = self.editButtonItem; - UIBarButtonItem* addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertNewObject:)]; + UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertNewObject:)]; self.navigationItem.rightBarButtonItem = addButton; } @@ -31,31 +31,32 @@ } - (void)insertNewObject:(id)sender { - if (!_objects) _objects = [NSMutableArray new]; + if (!_objects) + _objects = [NSMutableArray new]; [_objects insertObject:[NSDate date] atIndex:0]; - NSIndexPath* indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; + NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; [self.tableView insertRowsAtIndexPaths:@[ indexPath ] withRowAnimation:UITableViewRowAnimationAutomatic]; } #pragma mark - Table View -- (NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section { +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return _objects.count; } -- (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath { - UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath]; +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath]; - NSDate* object = _objects[indexPath.row]; + NSDate *object = _objects[indexPath.row]; cell.textLabel.text = [object description]; return cell; } -- (BOOL)tableView:(UITableView*)tableView canEditRowAtIndexPath:(NSIndexPath*)indexPath { +- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { return YES; } -- (void)tableView:(UITableView*)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath*)indexPath { +- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { [_objects removeObjectAtIndex:indexPath.row]; [tableView deleteRowsAtIndexPaths:@[ indexPath ] withRowAnimation:UITableViewRowAnimationFade]; @@ -64,10 +65,10 @@ } } -- (void)prepareForSegue:(UIStoryboardSegue*)segue sender:(id)sender { +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"showDetail"]) { - NSIndexPath* indexPath = [self.tableView indexPathForSelectedRow]; - NSDate* object = _objects[indexPath.row]; + NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; + NSDate *object = _objects[indexPath.row]; [[segue destinationViewController] setDetailItem:object]; } } diff --git a/Example/TouchVisualizer/Images.xcassets/AppIcon.appiconset/Contents.json b/Example/TouchVisualizer/Images.xcassets/AppIcon.appiconset/Contents.json index a396706..33ec0bc 100644 --- a/Example/TouchVisualizer/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/Example/TouchVisualizer/Images.xcassets/AppIcon.appiconset/Contents.json @@ -14,6 +14,11 @@ "idiom" : "iphone", "size" : "60x60", "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" } ], "info" : { diff --git a/Example/TouchVisualizer/Launch Screen.xib b/Example/TouchVisualizer/Launch Screen.xib new file mode 100644 index 0000000..e7367e3 --- /dev/null +++ b/Example/TouchVisualizer/Launch Screen.xib @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/TouchVisualizer/Main.storyboard b/Example/TouchVisualizer/Main.storyboard new file mode 100644 index 0000000..f6527ff --- /dev/null +++ b/Example/TouchVisualizer/Main.storyboard @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/TouchVisualizer/TouchVisualizer-Info.plist b/Example/TouchVisualizer/TouchVisualizer-Info.plist index 8bedc33..fcb17b5 100644 --- a/Example/TouchVisualizer/TouchVisualizer-Info.plist +++ b/Example/TouchVisualizer/TouchVisualizer-Info.plist @@ -24,6 +24,8 @@ 1.0 LSRequiresIPhoneOS + UILaunchStoryboardName + Launch Screen UIMainStoryboardFile Main UIRequiredDeviceCapabilities @@ -46,5 +48,7 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + UIViewControllerBasedStatusBarAppearance + diff --git a/touchvisdemo.gif b/touchvisdemo.gif index 521e60f..04000ff 100644 Binary files a/touchvisdemo.gif and b/touchvisdemo.gif differ