From 8a1adea4e8f486828cfcfc4bc6bd5b104bdf17f8 Mon Sep 17 00:00:00 2001 From: Louis-Alban KIM Date: Thu, 14 Jun 2012 19:31:25 +0200 Subject: [PATCH 1/5] Add swipe recognizer to move to original from fullscreen --- PSPushPopPressView.h | 1 + PSPushPopPressView.m | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/PSPushPopPressView.h b/PSPushPopPressView.h index 57b307e..ce7c0c7 100755 --- a/PSPushPopPressView.h +++ b/PSPushPopPressView.h @@ -41,6 +41,7 @@ UITapGestureRecognizer* tapRecognizer_; UILongPressGestureRecognizer* doubleTouchRecognizer; UIPanGestureRecognizer* panRecognizer_; + UISwipeGestureRecognizer* swipeRecognizer_; CGAffineTransform scaleTransform_; CGAffineTransform rotateTransform_; CGAffineTransform panTransform_; diff --git a/PSPushPopPressView.m b/PSPushPopPressView.m index 067542a..e7c87f6 100755 --- a/PSPushPopPressView.m +++ b/PSPushPopPressView.m @@ -94,6 +94,14 @@ - (id)initWithFrame:(CGRect)frame_ { doubleTouchRecognizer.numberOfTouchesRequired = 2; doubleTouchRecognizer.minimumPressDuration = 0.f; [self addGestureRecognizer:doubleTouchRecognizer]; + + swipeRecognizer_ = [[UISwipeGestureRecognizer alloc] initWithTarget:self action: @selector(swipe:)]; + swipeRecognizer_.delegate = self; + swipeRecognizer_.cancelsTouchesInView = NO; + swipeRecognizer_.delaysTouchesBegan = NO; + swipeRecognizer_.delaysTouchesEnded = NO; + swipeRecognizer_.direction = UISwipeGestureRecognizerDirectionRight | UISwipeGestureRecognizerDirectionLeft | UISwipeGestureRecognizerDirectionUp | UISwipeGestureRecognizerDirectionDown; + [self addGestureRecognizer:swipeRecognizer_]; self.layer.shadowRadius = 15.0f; self.layer.shadowOffset = CGSizeMake(5.0f, 5.0f); @@ -512,6 +520,19 @@ - (void)tap:(UITapGestureRecognizer *)tap { } } +- (void)swipe:(UISwipeGestureRecognizer *)swipe { + if (swipe.state == UIGestureRecognizerStateEnded) { + + if (self.isFullscreen) { + if ([self.pushPopPressViewDelegate respondsToSelector: @selector(pushPopPressViewShouldAllowTapToAnimateToOriginalFrame:)]) { + if ([self.pushPopPressViewDelegate pushPopPressViewShouldAllowTapToAnimateToOriginalFrame: self] == NO) return; + } + + [self moveToOriginalFrameAnimated:YES]; + } + } +} + - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { // if the gesture recognizers's view isn't one of our pieces, don't allow simultaneous recognition if (gestureRecognizer.view != self) From b1798f32d29221f7b412503e432b727946bde533 Mon Sep 17 00:00:00 2001 From: Louis-Alban KIM Date: Tue, 19 Jun 2012 20:28:43 +0200 Subject: [PATCH 2/5] Add allowFullscreenInteraction switch --- PSPushPopPressView.h | 4 ++++ PSPushPopPressView.m | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/PSPushPopPressView.h b/PSPushPopPressView.h index ce7c0c7..2a5f00c 100755 --- a/PSPushPopPressView.h +++ b/PSPushPopPressView.h @@ -48,6 +48,7 @@ CGRect initialFrame_; NSInteger initialIndex_; BOOL allowSingleTapSwitch_; + BOOL allowFullscreenInteraction_; BOOL fullscreen_; BOOL ignoreStatusBar_; BOOL keepShadow_; @@ -70,6 +71,9 @@ /// allow mode switching via single tap. Defaults to YES. @property (nonatomic, assign) BOOL allowSingleTapSwitch; +/// allow user interaction in fullscreen. Defaults to YES. +@property (nonatomic, assign) BOOL allowFullscreenInteraction; + /// if true, [UIScreen mainScreen] is used for coordinates (vs rootView) @property (nonatomic, assign) BOOL ignoreStatusBar; diff --git a/PSPushPopPressView.m b/PSPushPopPressView.m index e7c87f6..8a04d83 100755 --- a/PSPushPopPressView.m +++ b/PSPushPopPressView.m @@ -33,6 +33,7 @@ @implementation PSPushPopPressView @synthesize fullscreen = fullscreen_; @synthesize initialFrame = initialFrame_; @synthesize allowSingleTapSwitch = allowSingleTapSwitch_; +@synthesize allowFullscreenInteraction = allowFullscreenInteraction_; @synthesize ignoreStatusBar = ignoreStatusBar_; @synthesize keepShadow = keepShadow_; @@ -54,6 +55,7 @@ - (id)initWithFrame:(CGRect)frame_ { initialFrame_ = frame_; initialIndex_ = 0; allowSingleTapSwitch_ = YES; + allowFullscreenInteraction_ = YES; keepShadow_ = NO; UIPinchGestureRecognizer* pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinchPanRotate:)]; @@ -428,6 +430,8 @@ - (void)adjustAnchorPointForGestureRecognizer:(UIGestureRecognizer *)gestureReco } - (void)pinchPanRotate:(UIGestureRecognizer *)gesture { + if (self.isFullscreen && !self.allowFullscreenInteraction) + return; switch (gesture.state) { case UIGestureRecognizerStateBegan: { @@ -460,6 +464,9 @@ - (void)pinchPanRotate:(UIGestureRecognizer *)gesture { } - (void)doubleTapped:(UITapGestureRecognizer *)gesture { + if (self.isFullscreen && !self.allowFullscreenInteraction) + return; + switch (gesture.state) { case UIGestureRecognizerStateBegan: { self.beingDragged = YES; @@ -497,6 +504,9 @@ - (void)doubleTapped:(UITapGestureRecognizer *)gesture { } - (void)tap:(UITapGestureRecognizer *)tap { + if (self.isFullscreen && !self.allowFullscreenInteraction) + return; + if (self.allowSingleTapSwitch) { if (tap.state == UIGestureRecognizerStateEnded) { if ([self.pushPopPressViewDelegate respondsToSelector: @selector(pushPopPressViewDidReceiveTap:)]) { @@ -521,6 +531,9 @@ - (void)tap:(UITapGestureRecognizer *)tap { } - (void)swipe:(UISwipeGestureRecognizer *)swipe { + if (self.isFullscreen && !self.allowFullscreenInteraction) + return; + if (swipe.state == UIGestureRecognizerStateEnded) { if (self.isFullscreen) { @@ -534,6 +547,10 @@ - (void)swipe:(UISwipeGestureRecognizer *)swipe { } - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { + // if in fullscreen and fullscreen interaction is disabled, allow simultaneous recognition + if (self.isFullscreen && !self.allowFullscreenInteraction) + return YES; + // if the gesture recognizers's view isn't one of our pieces, don't allow simultaneous recognition if (gestureRecognizer.view != self) return NO; From 44dd83ac255b52a5c2758e226d43d09bff5fcdbd Mon Sep 17 00:00:00 2001 From: Arnaud Coomans Date: Thu, 19 Jul 2012 23:26:30 -0700 Subject: [PATCH 3/5] Updated gitignore --- .gitignore | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 6256b64..5ba3b59 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,16 @@ -.DS_Store -*.xcuserdatad -*xcworkspace* +# Xcode +build/* +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +*.xcworkspace +!default.xcworkspace +xcuserdata +profile +*.moved-aside +DerivedData \ No newline at end of file From 726a75e97c0d340cfc1540fffb6bb01d6de876a8 Mon Sep 17 00:00:00 2001 From: Arnaud Coomans Date: Fri, 30 Nov 2012 14:58:39 +0100 Subject: [PATCH 4/5] Updated project settings --- PSPushPopPressView.xcodeproj/project.pbxproj | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PSPushPopPressView.xcodeproj/project.pbxproj b/PSPushPopPressView.xcodeproj/project.pbxproj index 024ac4c..52b623a 100644 --- a/PSPushPopPressView.xcodeproj/project.pbxproj +++ b/PSPushPopPressView.xcodeproj/project.pbxproj @@ -110,7 +110,7 @@ 78A918351478122900EFFC4D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0420; + LastUpgradeCheck = 0450; }; buildConfigurationList = 78A918381478122900EFFC4D /* Build configuration list for PBXProject "PSPushPopPressView" */; compatibilityVersion = "Xcode 3.2"; @@ -160,6 +160,7 @@ "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; @@ -181,6 +182,7 @@ CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; @@ -196,6 +198,7 @@ buildSettings = { DSTROOT = /tmp/PSPushPopPressView.dst; GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_THUMB_SUPPORT = NO; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -207,6 +210,7 @@ buildSettings = { DSTROOT = /tmp/PSPushPopPressView.dst; GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_THUMB_SUPPORT = NO; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; From 4fe5897dd4720f5c476f63e6d064acf7aa4da32d Mon Sep 17 00:00:00 2001 From: Louis-Alban KIM Date: Wed, 24 Apr 2013 11:34:24 +0200 Subject: [PATCH 5/5] Update project settings --- PSPushPopPressView.xcodeproj/project.pbxproj | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/PSPushPopPressView.xcodeproj/project.pbxproj b/PSPushPopPressView.xcodeproj/project.pbxproj index 52b623a..69c39f8 100644 --- a/PSPushPopPressView.xcodeproj/project.pbxproj +++ b/PSPushPopPressView.xcodeproj/project.pbxproj @@ -110,7 +110,7 @@ 78A918351478122900EFFC4D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0450; + LastUpgradeCheck = 0460; }; buildConfigurationList = 78A918381478122900EFFC4D /* Build configuration list for PBXProject "PSPushPopPressView" */; compatibilityVersion = "Xcode 3.2"; @@ -151,6 +151,10 @@ armv6, ); CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; @@ -164,6 +168,7 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 4.0; SDKROOT = iphoneos; @@ -180,12 +185,17 @@ armv6, ); CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 4.0; SDKROOT = iphoneos;