Skip to content
Open
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
24 changes: 6 additions & 18 deletions STPopup/STPopupNavigationBar.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ - (instancetype)initWithFrame:(CGRect)frame

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
if (!self.draggable) {
[super touchesBegan:touches withEvent:event];
return;
}
[super touchesBegan:touches withEvent:event];

UITouch *touch = [touches anyObject];
if ((touch.view == self || touch.view.superview == self) && !_moving) {
Expand All @@ -51,10 +48,7 @@ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
if (!self.draggable) {
[super touchesMoved:touches withEvent:event];
return;
}
[super touchesMoved:touches withEvent:event];

if (_moving) {
UITouch *touch = [touches anyObject];
Expand All @@ -67,30 +61,24 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event

- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
if (!self.draggable) {
[super touchesCancelled:touches withEvent:event];
return;
}

if (_moving) {
UITouch *touch = [touches anyObject];
float offset = [touch locationInView:self.window].y - _movingStartY;
[self movingDidEndWithOffset:offset];
}

[super touchesCancelled:touches withEvent:event];
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
if (!self.draggable) {
[super touchesEnded:touches withEvent:event];
return;
}

if (_moving) {
UITouch *touch = [touches anyObject];
float offset = [touch locationInView:self.window].y - _movingStartY;
[self movingDidEndWithOffset:offset];
}

[super touchesEnded:touches withEvent:event];
}

- (void)movingDidEndWithOffset:(float)offset
Expand Down