diff --git a/Signal/src/ViewControllers/ProfileBioViewController.swift b/Signal/src/ViewControllers/ProfileBioViewController.swift index 8cc49b8f8d..ec64cf1e2f 100644 --- a/Signal/src/ViewControllers/ProfileBioViewController.swift +++ b/Signal/src/ViewControllers/ProfileBioViewController.swift @@ -43,6 +43,8 @@ class ProfileBioViewController: OWSTableViewController { self.bioTextField.text = bio self.bioEmojiLabel.text = bioEmoji + + self.shouldAvoidKeyboard = true } // MARK: - Orientation diff --git a/Signal/src/ViewControllers/ProfileViewController.swift b/Signal/src/ViewControllers/ProfileViewController.swift index 471d149878..a9b4639546 100644 --- a/Signal/src/ViewControllers/ProfileViewController.swift +++ b/Signal/src/ViewControllers/ProfileViewController.swift @@ -73,6 +73,8 @@ public class ProfileViewController: OWSTableViewController { self.completionHandler = completionHandler super.init() + + self.shouldAvoidKeyboard = true } // MARK: - Orientation diff --git a/SignalMessaging/ViewControllers/OWSTableViewController.h b/SignalMessaging/ViewControllers/OWSTableViewController.h index 2a0f25ca64..c56850633b 100644 --- a/SignalMessaging/ViewControllers/OWSTableViewController.h +++ b/SignalMessaging/ViewControllers/OWSTableViewController.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2020 Open Whisper Systems. All rights reserved. +// Copyright (c) 2021 Open Whisper Systems. All rights reserved. // #import @@ -195,6 +195,8 @@ typedef BOOL (^OWSTableSwitchBlock)(void); @property (nonatomic, nullable) UIColor *customSectionHeaderFooterBackgroundColor; +@property (nonatomic) BOOL shouldAvoidKeyboard; + - (instancetype)init NS_DESIGNATED_INITIALIZER; #pragma mark - Presentation diff --git a/SignalMessaging/ViewControllers/OWSTableViewController.m b/SignalMessaging/ViewControllers/OWSTableViewController.m index 9f0a19d26e..08da85e045 100644 --- a/SignalMessaging/ViewControllers/OWSTableViewController.m +++ b/SignalMessaging/ViewControllers/OWSTableViewController.m @@ -1,5 +1,5 @@ // -// Copyright (c) 2020 Open Whisper Systems. All rights reserved. +// Copyright (c) 2021 Open Whisper Systems. All rights reserved. // #import "OWSTableViewController.h" @@ -607,7 +607,12 @@ NSString *const kOWSTableCellIdentifier = @"kOWSTableCellIdentifier"; // We don't need a top or bottom insets, since we pin to the top and bottom layout guides. self.automaticallyAdjustsScrollViewInsets = NO; } else { - [self.tableView autoPinEdgesToSuperviewEdges]; + if (self.shouldAvoidKeyboard) { + [self.tableView autoPinEdgesToSuperviewEdgesWithInsets:UIEdgeInsetsZero excludingEdge:ALEdgeBottom]; + [self autoPinViewToBottomOfViewControllerOrKeyboard:self.tableView avoidNotch:YES]; + } else { + [self.tableView autoPinEdgesToSuperviewEdges]; + } } [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kOWSTableCellIdentifier];