Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CXCardView/CXCardContainerView.m
Original file line number Diff line number Diff line change
Expand Up @@ -168,5 +168,9 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
}
}

-(void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
[self touchesEnded:touches withEvent:event];
}

#pragma mark - Private Method
@end
10 changes: 9 additions & 1 deletion CXCardView/CXCardView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down