Search code examples
iosautolayoutconstraintsui-designadaptive-layout

How To Design an UI to support all the screens of iPhones and iPads


I am working on a project in which I have to support all the iPhones screens like (iPhone4, iPhone 4S, iPhone 5S, iPhone 6, iPhone 6+) and iPads(iPad Mini, iPad Air, iPad Air 2, iPad 4, etc).

I was in a thought of using AutoLayout and AdaptiveLayout for the UI design. I learn that and try to apply in my project. I was more or less successful with the design with autolayout and adaptive layout, but, there is problem with resizing the textfield when the user edits it.

when the user tries to edit the textfield, we need to bring the textfield on top of the keyboard. so, that can be done in code,but, when we use the auto layout, this code is not working now. As per concept, when we use auto layout, we cannot resize the frame of the controls in view dynamically through code.

I am struck now?. Please help me with this guys. Thanks in Advance


Solution

  • Please refer this link for the answer. It will help us to bring the textfield on top even if we use AutoLayout.

    https://github.com/michaeltyson/TPKeyboardAvoiding/blob/master/TPKeyboardAvoiding/TPKeyboardAvoidingScrollView.m