From 6b5f90996a0f67a6c2cdd7fb816d24055bf9b412 Mon Sep 17 00:00:00 2001 From: Juan Carlos Chomali Date: Mon, 2 Feb 2015 18:25:39 -0200 Subject: [PATCH 1/2] Update CXCardView.m Dismiss when background is tapped now supported --- CXCardView/CXCardView.m | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CXCardView/CXCardView.m b/CXCardView/CXCardView.m index 937f19d..f0d3ffa 100644 --- a/CXCardView/CXCardView.m +++ b/CXCardView/CXCardView.m @@ -94,10 +94,18 @@ - (id)initWithFrame:(CGRect)frame self = [super initWithFrame:frame]; if (self) { // Initialization code + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backgroundTapped:)]; + [self addGestureRecognizer:tap]; } return self; } - +- (void)backgroundTapped:(UITapGestureRecognizer *)tgr{ + CGPoint touchedPoint = [tgr locationInView:self]; + if (!CGRectContainsPoint(self.containerView.frame, touchedPoint)) { + //Dismiss when background is tapped + [self dismiss]; + } +} - (void)setDraggable:(BOOL)draggable { if (_draggable == draggable) { From 10990a0efb1ca46a491803271943df09ee57d8d7 Mon Sep 17 00:00:00 2001 From: Juan Chomali Date: Tue, 13 Oct 2015 21:10:55 -0200 Subject: [PATCH 2/2] Update CXCardContainerView.m The method "touchesCancelled:" was not implemented and was causing some bugs. --- CXCardView/CXCardContainerView.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CXCardView/CXCardContainerView.m b/CXCardView/CXCardContainerView.m index bbbfcce..6e80a20 100644 --- a/CXCardView/CXCardContainerView.m +++ b/CXCardView/CXCardContainerView.m @@ -168,5 +168,9 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event } } +-(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event{ + [self touchesEnded:touches withEvent:event]; +} + #pragma mark - Private Method @end