From cc5cc2b9c6f78e5081c72d4d40d8998aac1f21c5 Mon Sep 17 00:00:00 2001 From: Alexey Grabik Date: Tue, 24 Apr 2018 16:41:00 +0300 Subject: [PATCH] setup web view through constraints in order to seamless support iPhone X --- Pod/Core/ios/SimpleAuthWebViewController.m | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Pod/Core/ios/SimpleAuthWebViewController.m b/Pod/Core/ios/SimpleAuthWebViewController.m index 33f0ec9..0b0cddb 100644 --- a/Pod/Core/ios/SimpleAuthWebViewController.m +++ b/Pod/Core/ios/SimpleAuthWebViewController.m @@ -25,11 +25,20 @@ @implementation SimpleAuthWebViewController { - (void)viewDidLoad { [super viewDidLoad]; + self.view.backgroundColor = [UIColor whiteColor]; - self.webView.frame = self.view.bounds; - [self.view addSubview:self.webView]; + [self setupWebView]; } +- (void)setupWebView { + [self.view addSubview:self.webView]; + + self.webView.translatesAutoresizingMaskIntoConstraints = NO; + [self.webView.topAnchor constraintEqualToAnchor:self.view.layoutMarginsGuide.topAnchor].active = YES; + [self.webView.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor].active = YES; + [self.webView.bottomAnchor constraintEqualToAnchor:self.view.layoutMarginsGuide.bottomAnchor].active = YES; + [self.webView.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor].active = YES; +} - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; @@ -102,7 +111,6 @@ + (NSURLRequest *)canonicalRequestForRequest:(NSURLRequest *)request { - (UIWebView *)webView { if (!_webView) { _webView = [UIWebView new]; - _webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); _webView.delegate = self; } return _webView;