Ensure onboarding views never reclaim layout space from dismissed keyboard.

pull/2/head
Matthew Chen 6 years ago
parent 53802d1a48
commit d72c26796d

@ -73,6 +73,12 @@ public class OnboardingBaseViewController: OWSViewController {
// MARK: - View Lifecycle
public override func viewDidLoad() {
super.viewDidLoad()
self.shouldBottomViewReserveSpaceForKeyboard = true
}
public override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

@ -20,6 +20,10 @@ UIInterfaceOrientationMask DefaultUIInterfaceOrientationMask(void);
// BUT adjust its location upward if the keyboard appears.
- (void)autoPinViewToBottomOfViewControllerOrKeyboard:(UIView *)view avoidNotch:(BOOL)avoidNotch;
// If YES, the bottom view never "reclaims" layout space if the keyboard is dismissed.
// Defaults to NO.
@property (nonatomic) BOOL shouldBottomViewReserveSpaceForKeyboard;
@end
NS_ASSUME_NONNULL_END

@ -211,7 +211,11 @@ UIInterfaceOrientationMask DefaultUIInterfaceOrientationMask(void)
// There's no need to use: [UIView animateWithDuration:...].
// Any layout changes made during these notifications are
// automatically animated.
self.bottomLayoutConstraint.constant = offset;
if (self.shouldBottomViewReserveSpaceForKeyboard) {
self.bottomLayoutConstraint.constant = MIN(self.bottomLayoutConstraint.constant, offset);
} else {
self.bottomLayoutConstraint.constant = offset;
}
[self.bottomLayoutView.superview layoutIfNeeded];
};

Loading…
Cancel
Save