From de2a5d3cd7ecc8e398d2e8b1a436739d414597b6 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 1 Sep 2019 12:15:26 -0700 Subject: [PATCH] Fix overlays not being affected by button press and spinner eating touch events --- Limelight/UIComputerView.m | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Limelight/UIComputerView.m b/Limelight/UIComputerView.m index b29a2264..10ff5d3a 100644 --- a/Limelight/UIComputerView.m +++ b/Limelight/UIComputerView.m @@ -47,6 +47,9 @@ static const int LABEL_DY = 20; _hostButton.layer.shadowColor = [[UIColor blackColor] CGColor]; _hostButton.layer.shadowOffset = CGSizeMake(5,8); _hostButton.layer.shadowOpacity = 0.3; + + [_hostButton addTarget:self action:@selector(hostButtonSelected:) forControlEvents:UIControlEventTouchDown]; + [_hostButton addTarget:self action:@selector(hostButtonDeselected:) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchCancel | UIControlEventTouchDragExit]; _hostLabel = [[UILabel alloc] init]; _hostLabel.textColor = [UIColor whiteColor]; @@ -54,6 +57,7 @@ static const int LABEL_DY = 20; _hostOverlay = [[UIImageView alloc] initWithFrame:CGRectMake(_hostButton.frame.size.width / 3, _hostButton.frame.size.height / 4, _hostButton.frame.size.width / 3, _hostButton.frame.size.height / 3)]; _hostSpinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; [_hostSpinner setFrame:_hostOverlay.frame]; + _hostSpinner.userInteractionEnabled = NO; _hostSpinner.hidesWhenStopped = YES; [self addSubview:_hostButton]; @@ -64,6 +68,15 @@ static const int LABEL_DY = 20; return self; } +- (void) hostButtonSelected:(id)sender { + _hostSpinner.layer.opacity = 0.5f; + _hostOverlay.layer.opacity = 0.5f; +} +- (void) hostButtonDeselected:(id)sender { + _hostSpinner.layer.opacity = 1.0f; + _hostOverlay.layer.opacity = 1.0f; +} + - (id) initForAddWithCallback:(id)callback { self = [self init]; _callback = callback;