Reputation: 9072
I have the following portrait and landscape interface builder design for my project.
When the keyboard opens for the project it currently opens from the bottom of the screen. This is fine for portrait since none of the text field controls are covered but not for landscape.
I'm looking for a way for the keyboard to open from the right when under landscape orientation.
I'm currently using a library that scrolls the text fields you are editing into view automatically here (https://github.com/hackiftekhar/IQKeyboardManager), the only issue with this solution is the top field disappears from view in landscape view and in this programs case I need to be able to see all fields while entering the data on the keyboard.
I'm not sure if I need a custom keyboard solution or if that is even best practice in this case as I did not find anything in my research regarding this.
Below is an example of the keyboard issue I'm having.
Keyboard hiding bottom textfield:
Keyboard hiding top textfield:
There appears to be room in most cases for the keyboard to fit on the right as you can see in the landscape pictures. This is especially the case if it's possible to shrink the keys or it's size, but I can not find any info on this on here or apples developer website. Having the keyboard come from the right would allow all 4 text fields to be viewable while the user makes entries.
Any help is appreciated!
Upvotes: 0
Views: 362
Reputation: 42598
The standard approach to solve this kind of problem is use different layouts for the different orientations.
Total Dose [======] -*
Dose/Frac [======] -*
# Fractions [======] -*
alpha/beta [====] |-=|
Total Dose [======] -* Dose/Frac [======] -*
# Fractions [======] -* alpha/beta [====] |-=|
NOTE: [===]
are the text fields, -*
are the switches, and |-=|
is the segmented control.
How to handle portrait and landscape in autolayout shows how to use the size classes to setup constraints for the different orientations.
Upvotes: 4