Fixed safe area on iPhone X

This commit is contained in:
Oliver Ian Krakora 2018-05-11 18:14:51 +02:00
parent 4bf1eeaaa8
commit df1711a55d
2 changed files with 11 additions and 5 deletions

View File

@ -310,7 +310,7 @@
TargetAttributes = { TargetAttributes = {
CE412E8819D9A1E4000F294E = { CE412E8819D9A1E4000F294E = {
CreatedOnToolsVersion = 6.0.1; CreatedOnToolsVersion = 6.0.1;
DevelopmentTeam = WNK46V33W9; DevelopmentTeam = M8F9QH57A6;
LastSwiftMigration = 0900; LastSwiftMigration = 0900;
ProvisioningStyle = Automatic; ProvisioningStyle = Automatic;
}; };
@ -567,7 +567,7 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = WNK46V33W9; DEVELOPMENT_TEAM = M8F9QH57A6;
INFOPLIST_FILE = QRCodeReader.swift/Info.plist; INFOPLIST_FILE = QRCodeReader.swift/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.workandplay.qrcodereader; PRODUCT_BUNDLE_IDENTIFIER = com.workandplay.qrcodereader;
@ -582,7 +582,7 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = WNK46V33W9; DEVELOPMENT_TEAM = M8F9QH57A6;
INFOPLIST_FILE = QRCodeReader.swift/Info.plist; INFOPLIST_FILE = QRCodeReader.swift/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.workandplay.qrcodereader; PRODUCT_BUNDLE_IDENTIFIER = com.workandplay.qrcodereader;

View File

@ -150,8 +150,14 @@ public class QRCodeReaderViewController: UIViewController {
// Setup constraints // Setup constraints
for attribute in [.left, .top, .right, .bottom] as [NSLayoutAttribute] { for attribute in [.left, .top, .right] as [NSLayoutAttribute] {
view.addConstraint(NSLayoutConstraint(item: readerView.view, attribute: attribute, relatedBy: .equal, toItem: view, attribute: attribute, multiplier: 1, constant: 0)) NSLayoutConstraint(item: readerView.view, attribute: attribute, relatedBy: .equal, toItem: view, attribute: attribute, multiplier: 1, constant: 0).isActive = true
}
if #available(iOS 11.0, *) {
view.safeAreaLayoutGuide.bottomAnchor.constraint(equalTo: readerView.view.bottomAnchor).isActive = true
} else {
NSLayoutConstraint(item: readerView.view, attribute: .bottom, relatedBy: .equal, toItem: view, attribute: .bottom, multiplier: 1, constant: 0).isActive = true
} }
} }