further fix iPhone settings menu safe area issue
This commit is contained in:
@@ -379,22 +379,26 @@ BOOL isCustomResolution(int resolutionSelected) {
|
||||
return;
|
||||
}
|
||||
|
||||
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
|
||||
UIWindow *keyWindow = [UIApplication sharedApplication].windows.firstObject;
|
||||
|
||||
if(parentStackWidthConstraint && parentStackLeadingConstraint) [NSLayoutConstraint deactivateConstraints:@[parentStackLeadingConstraint, parentStackWidthConstraint]];
|
||||
|
||||
switch (orientation) {
|
||||
case UIDeviceOrientationLandscapeLeft:
|
||||
parentStackLeadingConstraint = [_parentStack.leadingAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.leadingAnchor constant:0];
|
||||
parentStackWidthConstraint = [_parentStack.widthAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.widthAnchor constant:-10];
|
||||
break;
|
||||
default:
|
||||
parentStackLeadingConstraint = [_parentStack.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor constant:10];
|
||||
parentStackWidthConstraint = [_parentStack.widthAnchor constraintEqualToAnchor:self.view.widthAnchor constant:-20];
|
||||
break;
|
||||
if (@available(iOS 13.0, *)) {
|
||||
if(parentStackWidthConstraint && parentStackLeadingConstraint) [NSLayoutConstraint deactivateConstraints:@[parentStackLeadingConstraint, parentStackWidthConstraint]];
|
||||
UIInterfaceOrientation currentOrientation = keyWindow.windowScene.interfaceOrientation;
|
||||
switch (currentOrientation) {
|
||||
case UIInterfaceOrientationLandscapeRight:
|
||||
parentStackLeadingConstraint = [_parentStack.leadingAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.leadingAnchor constant:0];
|
||||
parentStackWidthConstraint = [_parentStack.widthAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.widthAnchor constant:-10];
|
||||
break;
|
||||
default:
|
||||
parentStackLeadingConstraint = [_parentStack.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor constant:10];
|
||||
parentStackWidthConstraint = [_parentStack.widthAnchor constraintEqualToAnchor:self.view.widthAnchor constant:-20];
|
||||
break;
|
||||
}
|
||||
[NSLayoutConstraint activateConstraints:@[parentStackLeadingConstraint, parentStackWidthConstraint]];
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
|
||||
[NSLayoutConstraint activateConstraints:@[parentStackLeadingConstraint, parentStackWidthConstraint]];
|
||||
|
||||
double delayInSeconds = 0.05;
|
||||
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
|
||||
|
||||
Reference in New Issue
Block a user