Search code examples
xcodeinterface-buildersize-classes

UITextField in UIToolBar not adhereing to Size Classes


I have a UITextfield in a UIToolbar and it doesn't seem to want to stretch from end to end like it does on an iphone. So this is what I have for the w:any h:any size class

enter image description here

That works just fine on iphone devices. But when I align it on the w:regular h:regular size class for ipad it completely ignores it on the device.

enter image description here

In the preview it looks fine but once it is on a device (ipad) the UITextfield is tiny, its as wide as the one on an iphone.


Solution

  • Judging by the information you provided in your comment, it sounds like you've set the constraints to a set number. I would suggest setting your constraints up using ratios and multipliers. This will make sure the constrained objects are based on the SuperView's size (or rather a percentage of it).

    Check out the following links for more information: