Skip to content

Commit

Permalink
Fix example project bottom margin
Browse files Browse the repository at this point in the history
  • Loading branch information
devxoul committed Jun 10, 2018
1 parent 0bf9f54 commit fdad96f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Example/RxKeyboardExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -392,7 +392,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand Down
17 changes: 10 additions & 7 deletions Example/Sources/ViewControllers/MessageListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,12 @@ class MessageListViewController: UIViewController {
RxKeyboard.instance.visibleHeight
.drive(onNext: { [weak self] keyboardVisibleHeight in
guard let `self` = self, self.didSetupViewConstraints else { return }
var actualKeyboardHeight = keyboardVisibleHeight
if #available(iOS 11.0, *), keyboardVisibleHeight > 0 {
actualKeyboardHeight = actualKeyboardHeight - self.view.safeAreaInsets.bottom
}

self.messageInputBar.snp.updateConstraints { make in
make.bottom.equalTo(self.bottomLayoutGuide.snp.top).offset(-actualKeyboardHeight)
if #available(iOS 11.0, *) {
make.bottom.equalTo(self.view.safeAreaLayoutGuide.snp.bottom).offset(-keyboardVisibleHeight)
} else {
make.bottom.equalTo(self.bottomLayoutGuide.snp.top).offset(-keyboardVisibleHeight)
}
}
self.view.setNeedsLayout()
UIView.animate(withDuration: 0) {
Expand Down Expand Up @@ -140,7 +139,11 @@ class MessageListViewController: UIViewController {
}
self.messageInputBar.snp.makeConstraints { make in
make.left.right.equalTo(0)
make.bottom.equalTo(self.bottomLayoutGuide.snp.top)
if #available(iOS 11.0, *) {
make.bottom.equalTo(self.view.safeAreaLayoutGuide.snp.bottom)
} else {
make.bottom.equalTo(self.bottomLayoutGuide.snp.top)
}
}
}

Expand Down

0 comments on commit fdad96f

Please sign in to comment.