From 86553b62f921b5f81996b1999ca15743504ee086 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Mon, 2 Apr 2018 17:00:55 -0400 Subject: [PATCH] keyboard pinning vs iPhoneX --- .../GifPicker/GifPickerViewController.swift | 2 +- .../ViewControllers/NewContactThreadViewController.m | 2 +- Signal/src/ViewControllers/NewGroupViewController.m | 2 +- .../ThreadSettings/UpdateGroupViewController.m | 2 +- SignalMessaging/ViewControllers/OWSViewController.h | 11 ++++------- SignalMessaging/ViewControllers/OWSViewController.m | 6 +++--- 6 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Signal/src/ViewControllers/GifPicker/GifPickerViewController.swift b/Signal/src/ViewControllers/GifPicker/GifPickerViewController.swift index 8a8ee98d7..7be95ec51 100644 --- a/Signal/src/ViewControllers/GifPicker/GifPickerViewController.swift +++ b/Signal/src/ViewControllers/GifPicker/GifPickerViewController.swift @@ -188,7 +188,7 @@ class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollect bottomBanner.autoPinEdge(toSuperviewEdge: .top) bottomBanner.autoPinWidthToSuperview() - self.autoPinView(toBottomGuideOrKeyboard: bottomBanner) + self.autoPinView(toBottomOfViewControllerOrKeyboard: bottomBanner) // The Giphy API requires us to "show their trademark prominently" in our GIF experience. let logoImage = UIImage(named: "giphy_logo") diff --git a/Signal/src/ViewControllers/NewContactThreadViewController.m b/Signal/src/ViewControllers/NewContactThreadViewController.m index 662168946..f955ddd7a 100644 --- a/Signal/src/ViewControllers/NewContactThreadViewController.m +++ b/Signal/src/ViewControllers/NewContactThreadViewController.m @@ -125,7 +125,7 @@ NS_ASSUME_NONNULL_BEGIN [_tableViewController.view autoPinWidthToSuperview]; [_tableViewController.view autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:contactsPermissionReminderView]; - [self autoPinViewToBottomGuideOrKeyboard:self.tableViewController.view]; + [self autoPinViewToBottomOfViewControllerOrKeyboard:self.tableViewController.view]; _tableViewController.tableView.tableHeaderView = searchBar; _noSignalContactsView = [self createNoSignalContactsView]; diff --git a/Signal/src/ViewControllers/NewGroupViewController.m b/Signal/src/ViewControllers/NewGroupViewController.m index 335ae760f..4ad630a84 100644 --- a/Signal/src/ViewControllers/NewGroupViewController.m +++ b/Signal/src/ViewControllers/NewGroupViewController.m @@ -124,7 +124,7 @@ const NSUInteger kNewGroupViewControllerAvatarWidth = 68; [self.view addSubview:self.tableViewController.view]; [_tableViewController.view autoPinWidthToSuperview]; [_tableViewController.view autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:firstSection]; - [self autoPinViewToBottomGuideOrKeyboard:self.tableViewController.view]; + [self autoPinViewToBottomOfViewControllerOrKeyboard:self.tableViewController.view]; [self updateTableContents]; } diff --git a/Signal/src/ViewControllers/ThreadSettings/UpdateGroupViewController.m b/Signal/src/ViewControllers/ThreadSettings/UpdateGroupViewController.m index 0fedeb73c..fcea5ff6f 100644 --- a/Signal/src/ViewControllers/ThreadSettings/UpdateGroupViewController.m +++ b/Signal/src/ViewControllers/ThreadSettings/UpdateGroupViewController.m @@ -120,7 +120,7 @@ NS_ASSUME_NONNULL_BEGIN [self.view addSubview:self.tableViewController.view]; [_tableViewController.view autoPinWidthToSuperview]; [_tableViewController.view autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:firstSection]; - [self autoPinViewToBottomGuideOrKeyboard:self.tableViewController.view]; + [self autoPinViewToBottomOfViewControllerOrKeyboard:self.tableViewController.view]; [self updateTableContents]; } diff --git a/SignalMessaging/ViewControllers/OWSViewController.h b/SignalMessaging/ViewControllers/OWSViewController.h index df4a5314b..1afe534ee 100644 --- a/SignalMessaging/ViewControllers/OWSViewController.h +++ b/SignalMessaging/ViewControllers/OWSViewController.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // #import @@ -10,12 +10,9 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic) BOOL shouldIgnoreKeyboardChanges; -// We often want to pin one view to the bottom guide -// of a view controller BUT adjust its location upward -// if the keyboard appears. -// -// Use this method in lieu of autoPinToBottomLayoutGuideOfViewController: -- (void)autoPinViewToBottomGuideOrKeyboard:(UIView *)view; +// We often want to pin one view to the bottom of a view controller +// BUT adjust its location upward if the keyboard appears. +- (void)autoPinViewToBottomOfViewControllerOrKeyboard:(UIView *)view; @end diff --git a/SignalMessaging/ViewControllers/OWSViewController.m b/SignalMessaging/ViewControllers/OWSViewController.m index 21074f6d6..04551f654 100644 --- a/SignalMessaging/ViewControllers/OWSViewController.m +++ b/SignalMessaging/ViewControllers/OWSViewController.m @@ -2,8 +2,8 @@ // Copyright (c) 2018 Open Whisper Systems. All rights reserved. // +#import "OWSViewController.h" #import "UIView+OWS.h" -#import NS_ASSUME_NONNULL_BEGIN @@ -26,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN [[NSNotificationCenter defaultCenter] removeObserver:self]; } -- (void)autoPinViewToBottomGuideOrKeyboard:(UIView *)view +- (void)autoPinViewToBottomOfViewControllerOrKeyboard:(UIView *)view { OWSAssert(view); OWSAssert(!self.bottomLayoutConstraint); @@ -57,7 +57,7 @@ NS_ASSUME_NONNULL_BEGIN object:nil]; self.bottomLayoutView = view; - self.bottomLayoutConstraint = [view autoPinToBottomLayoutGuideOfViewController:self withInset:0]; + self.bottomLayoutConstraint = [view autoPinEdge:ALEdgeBottom toEdge:ALEdgeBottom ofView:self.view]; } - (void)keyboardWillShow:(NSNotification *)notification