This is an automated email from the ASF dual-hosted git repository.
erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git
The following commit(s) were added to refs/heads/master by this push:
new 1a5cd45e fix(splashscreen): positioning after rotation (#1315)
1a5cd45e is described below
commit 1a5cd45e2243b239b5045a0ade9d2da1d779b72a
Author: Darryl Pogue <[email protected]>
AuthorDate: Mon Apr 24 09:47:55 2023 -0700
fix(splashscreen): positioning after rotation (#1315)
Co-authored-by: Michael Goffioul <[email protected]>
---
CordovaLib/Classes/Public/CDVViewController.m | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/CordovaLib/Classes/Public/CDVViewController.m
b/CordovaLib/Classes/Public/CDVViewController.m
index 3eaa72b6..cd3bc9a1 100644
--- a/CordovaLib/Classes/Public/CDVViewController.m
+++ b/CordovaLib/Classes/Public/CDVViewController.m
@@ -501,18 +501,36 @@
webViewBounds.origin = self.view.bounds.origin;
UIView* view = [[UIView alloc] initWithFrame:webViewBounds];
+ view.translatesAutoresizingMaskIntoConstraints = NO;
[view setAlpha:0];
NSString* launchStoryboardName = [[NSBundle mainBundle]
objectForInfoDictionaryKey:@"UILaunchStoryboardName"];
if (launchStoryboardName != nil) {
UIStoryboard* storyboard = [UIStoryboard
storyboardWithName:launchStoryboardName bundle:[NSBundle mainBundle]];
UIViewController* vc = [storyboard instantiateInitialViewController];
+ [self addChildViewController:vc];
- [view addSubview:vc.view];
+ UIView* imgView = vc.view;
+ imgView.translatesAutoresizingMaskIntoConstraints = NO;
+ [view addSubview:imgView];
+
+ [NSLayoutConstraint activateConstraints:@[
+ [NSLayoutConstraint constraintWithItem:imgView
attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:view
attribute:NSLayoutAttributeWidth multiplier:1 constant:0],
+ [NSLayoutConstraint constraintWithItem:imgView
attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:view
attribute:NSLayoutAttributeHeight multiplier:1 constant:0],
+ [NSLayoutConstraint constraintWithItem:imgView
attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:view
attribute:NSLayoutAttributeCenterY multiplier:1 constant:0],
+ [NSLayoutConstraint constraintWithItem:imgView
attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:view
attribute:NSLayoutAttributeCenterX multiplier:1 constant:0]
+ ]];
}
self.launchView = view;
[self.view addSubview:view];
+
+ [NSLayoutConstraint activateConstraints:@[
+ [NSLayoutConstraint constraintWithItem:view
attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual
toItem:self.view attribute:NSLayoutAttributeWidth multiplier:1 constant:0],
+ [NSLayoutConstraint constraintWithItem:view
attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual
toItem:self.view attribute:NSLayoutAttributeHeight multiplier:1 constant:0],
+ [NSLayoutConstraint constraintWithItem:view
attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual
toItem:self.view attribute:NSLayoutAttributeCenterY multiplier:1 constant:0],
+ [NSLayoutConstraint constraintWithItem:view
attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual
toItem:self.view attribute:NSLayoutAttributeCenterX multiplier:1 constant:0]
+ ]];
}
- (void)createGapView
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]