mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-06-17 14:11:35 +00:00
Adjust settings view for iPhone X
This commit is contained in:
@@ -14,9 +14,30 @@
|
|||||||
|
|
||||||
@implementation SettingsViewController {
|
@implementation SettingsViewController {
|
||||||
NSInteger _bitrate;
|
NSInteger _bitrate;
|
||||||
|
Boolean _adjustedForSafeArea;
|
||||||
}
|
}
|
||||||
static NSString* bitrateFormat = @"Bitrate: %.1f Mbps";
|
static NSString* bitrateFormat = @"Bitrate: %.1f Mbps";
|
||||||
|
|
||||||
|
- (void)viewDidAppear:(BOOL)animated
|
||||||
|
{
|
||||||
|
[super viewDidAppear:animated];
|
||||||
|
|
||||||
|
// Adjust the subviews for the safe area on the iPhone X.
|
||||||
|
if (!_adjustedForSafeArea) {
|
||||||
|
if (@available(iOS 11.0, *)) {
|
||||||
|
for (UIView* view in self.view.subviews) {
|
||||||
|
// HACK: The official safe area is much too large for our purposes
|
||||||
|
// so we'll just use the presence of any safe area to indicate we should
|
||||||
|
// pad by 20.
|
||||||
|
if (self.view.safeAreaInsets.left >= 20 || self.view.safeAreaInsets.right >= 20) {
|
||||||
|
view.frame = CGRectMake(view.frame.origin.x + 20, view.frame.origin.y, view.frame.size.width, view.frame.size.height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_adjustedForSafeArea = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
|
|||||||
Reference in New Issue
Block a user