mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2025-07-27 06:32:59 +00:00
show an app title when the image of the app isn't available
This commit is contained in:
parent
c96a77f1aa
commit
aaeef1d6bb
Binary file not shown.
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 3.7 KiB |
@ -27,21 +27,6 @@ static int LABEL_DY = 20;
|
||||
[_appButton sizeToFit];
|
||||
[_appButton addTarget:self action:@selector(appClicked) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
// Remove Shadow and label
|
||||
/*
|
||||
_appButton.layer.shadowColor = [[UIColor blackColor] CGColor];
|
||||
_appButton.layer.shadowOffset = CGSizeMake(5,8);
|
||||
_appButton.layer.shadowOpacity = 0.7;
|
||||
|
||||
_appLabel = [[UILabel alloc] init];
|
||||
[_appLabel setText:_app.appName];
|
||||
[_appLabel sizeToFit];
|
||||
_appLabel.center = CGPointMake(_appButton.bounds.origin.x + (_appButton.bounds.size.width / 2), _appButton.bounds.origin.y + _appButton.bounds.size.height + LABEL_DY);
|
||||
|
||||
[self updateBounds];
|
||||
[self addSubview:_appLabel];
|
||||
*/
|
||||
|
||||
[self addSubview:_appButton];
|
||||
[self sizeToFit];
|
||||
|
||||
@ -66,6 +51,22 @@ static int LABEL_DY = 20;
|
||||
[_appButton setBackgroundImage:_app.appImage forState:UIControlStateNormal];
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
|
||||
// TODO: Improve no-app image detection
|
||||
if (_app.appImage == nil || (_app.appImage.size.width == 130.f && _app.appImage.size.height == 180.f)) { // This size of image might be blank image received from GameStream.
|
||||
_appLabel = [[UILabel alloc] init];
|
||||
CGFloat padding = 4.f;
|
||||
[_appLabel setFrame: CGRectMake(padding, padding, _appButton.frame.size.width - 2 * padding, _appButton.frame.size.height - 2 * padding)];
|
||||
[_appLabel setTextColor:[UIColor whiteColor]];
|
||||
[_appLabel setFont:[UIFont systemFontOfSize:10.f]];
|
||||
[_appLabel setBaselineAdjustment:UIBaselineAdjustmentAlignCenters];
|
||||
[_appLabel setTextAlignment:NSTextAlignmentCenter];
|
||||
[_appLabel setLineBreakMode:NSLineBreakByWordWrapping];
|
||||
[_appLabel setNumberOfLines:0];
|
||||
[_appLabel setText:_app.appName];
|
||||
[_appButton addSubview:_appLabel];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user