Fix host long press causing duplicate menus to show up

This commit is contained in:
Cameron Gutman
2018-11-16 20:05:06 -08:00
parent 70eb4fd69d
commit 87cac4e562

View File

@@ -80,7 +80,7 @@ static const int LABEL_DY = 20;
_host = host;
_callback = callback;
UILongPressGestureRecognizer* longPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(hostLongClicked)];
UILongPressGestureRecognizer* longPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(hostLongClicked:)];
[_hostButton addGestureRecognizer:longPressRecognizer];
[_hostButton addTarget:self action:@selector(hostClicked) forControlEvents:UIControlEventPrimaryActionTriggered];
@@ -169,8 +169,10 @@ static const int LABEL_DY = 20;
[self performSelector:@selector(updateLoop) withObject:self afterDelay:REFRESH_CYCLE];
}
- (void) hostLongClicked {
[_callback hostLongClicked:_host view:self];
- (void) hostLongClicked:(UILongPressGestureRecognizer*)gesture {
if (gesture.state == UIGestureRecognizerStateBegan) {
[_callback hostLongClicked:_host view:self];
}
}
- (void) hostClicked {