Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1952: Use SafeArea Autolayout Constraints when FormViewController Is Presented Modally #2148

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

philipbel
Copy link

@philipbel philipbel commented Mar 27, 2021

UITableView.scrollRectToVisible(, animated:) and UITableView.scrollToRow() don't work properly in keyboardWillShow() due to, what seems to be, a bug in iOS when autoresizing mask is used for a UIViewController that is presented modally as .formSheet/.pageSheet within a UINavigationController.

Tests are passing. My own iOS app is working fine with this fix. Comments/input is welcome.

// Need to set the background color as otherwise black shows underneath the translucent navigation bar.
view.backgroundColor = .systemBackground
tableView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for contributing. First comment is that a FormViewController can be created from a Storyboard where a UITableView is added with constraints (which might be equal to these but might as well not). The case where no Storyboard is used and the view controller is instantiated from code is handled in the if tableView == nil { above. As I understand, this issue only happens in that case, so any fix/workaround we apply should only apply to that case.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comment, Mathias.

I have updated the PR. Moved the constraints to a new function and I believe I am handling the Storyboard/non-Storyboard case now.

Is this more in-line with what you have in mind?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants