TechChain
TechChain

Reputation: 8952

TextField size issue on iPad?

I want my app to run on every device fine.I have text field on the screen.I am giving constraints to text field as follows:

I this case my text field will scale according to screen size.Now issue is when i use this method then all my textfields look too big on iPad.I have seen facebook app on which TextFileds don't look too big.I look decent so please tell me what method should i use for this purpose.I know i can use size classes but i don't want to use size classes in my project.

Solution i want if a textField is on iPhone 4s is 20px then on iPad it should be 24px with out using aspect ratio & size classes concept.

Upvotes: 0

Views: 606

Answers (1)

Irfan
Irfan

Reputation: 5130

Without Size classes You can achieve this using the following constraints. I have tested it on only one textfield and it is in center of screen. So overall constraints on this textfield is as follow:

  1. Align center X to SuperView
  2. Align center Y to SuperView
  3. Width >= 168
  4. Trailing Space to Superview Equals 270(approx) (priority = 999)
  5. Leading space to Superview Equals 270(approx) (Priority = 999)
  6. Height Equals : 30

What happen here is that On ipad 270 leading and trailing will be satisfied while on iphone having less width so both of these constraints shrink and width >= 68 constraints come in action. The result is show in pictures IPHONE enter image description here IPAD enter image description here

Upvotes: 1

Related Questions