VirtualProdigy
VirtualProdigy

Reputation: 1687

iOS Swift stackview inside a scrollview with constraints

I'm still getting familiar with iOS and the use of constraints. Initally had my layout setup with some constraints. But I ran into an issue. When entering text, my text fields are covered by the keyboard. I found some Apple docs: Doc One, Doc Two stating I should use a scrollviewin this case. It sounded easy enough but every time I put the content in the scrollview things go nuts. I've tried adjust my constraints in several ways, but nothing seems to help.

Anyone have any insight on what I'm missing? Thank you

Before adding the Scrollviewenter image description here

After adding the Scrollviewenter image description here

Upvotes: 1

Views: 1567

Answers (1)

rob mayoff
rob mayoff

Reputation: 385998

If you use a UITableView with static cells and make your view controller a subclass of `UITableViewController, you don't need to worry about the keyboard. The table view controller takes care of keeping the focussed text field visible above the keyboard:

tableview demo

I wrote no code for that demo. It's all done in the storyboard. Here's the storyboard outline:

storyboard outline

Upvotes: 2

Related Questions