mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-06-17 14:11:35 +00:00
Fix overlays not being affected by button press and spinner eating touch events
This commit is contained in:
@@ -48,12 +48,16 @@ static const int LABEL_DY = 20;
|
|||||||
_hostButton.layer.shadowOffset = CGSizeMake(5,8);
|
_hostButton.layer.shadowOffset = CGSizeMake(5,8);
|
||||||
_hostButton.layer.shadowOpacity = 0.3;
|
_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 = [[UILabel alloc] init];
|
||||||
_hostLabel.textColor = [UIColor whiteColor];
|
_hostLabel.textColor = [UIColor whiteColor];
|
||||||
|
|
||||||
_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)];
|
_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 = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
|
||||||
[_hostSpinner setFrame:_hostOverlay.frame];
|
[_hostSpinner setFrame:_hostOverlay.frame];
|
||||||
|
_hostSpinner.userInteractionEnabled = NO;
|
||||||
_hostSpinner.hidesWhenStopped = YES;
|
_hostSpinner.hidesWhenStopped = YES;
|
||||||
|
|
||||||
[self addSubview:_hostButton];
|
[self addSubview:_hostButton];
|
||||||
@@ -64,6 +68,15 @@ static const int LABEL_DY = 20;
|
|||||||
return self;
|
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<HostCallback>)callback {
|
- (id) initForAddWithCallback:(id<HostCallback>)callback {
|
||||||
self = [self init];
|
self = [self init];
|
||||||
_callback = callback;
|
_callback = callback;
|
||||||
|
|||||||
Reference in New Issue
Block a user