5

I am really frustrated since i migrated my project from Xcode 7.3 to Xcode 8.2. I am using both storyboard and Xib files in my project . While running my project I am getting this weird error. Some of my xib files are resized or reshaped(shrinked To fit/Expanded To fit). All this Xib files worked 100% perfectly in Xcode 7.3.

ScreenShot: screenShot

As you can see above the above view controller xib is as on Iphone5. But while running it expands to the blue lines. I am perfectly sure the auto layout is correct. I have solved this by changing the opening type of the xib document from Xcode8 to Xcode7,but to no good effect. It seems repeating again and again. In the above layout my views are arranged like this. Why is this happening. Is it a bug

Already tried: Link

ScreenShot: enter image description here

Community
  • 1
  • 1
Jeesson_7
  • 761
  • 1
  • 11
  • 38
  • are u working with swift or objective c – Uma Madhavi Apr 15 '17 at 07:46
  • Swift 2.3... i think it doesn't really matter about the programming language – Jeesson_7 Apr 15 '17 at 10:59
  • Have you tried changing Size Class in Interface Builder?? https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/AutolayoutPG/Size-ClassSpecificLayout.html – Alvaro Apr 17 '17 at 09:42
  • Yes I did.. I tried changing trait variant of xib files. – Jeesson_7 Apr 17 '17 at 09:59
  • 1
    Please review the link(http://stackoverflow.com/questions/40628249/autolayout-constraint-issues-in-ios-10-xcode-8/40735930#40735930) which might help you. – Ramkrishna Sharma Apr 17 '17 at 15:02
  • It initially changes, but on Opening xcode again it is present again – Jeesson_7 Apr 18 '17 at 04:04
  • Its been like this since I updated to Xcode 8.2 . I cannot update to Xcode 8.3 as it has no support for swift 2.3. – Jeesson_7 Apr 18 '17 at 04:06
  • did you try changing constraints relative ? it seems your constraints are relative to margined of the layout guide, you can edit the constraints, or re add with unchecking relative to margin check button while adding constraints. – dip Apr 18 '17 at 13:19
  • ok I tried.. but when i checked the constraints to margin was already unticked – Jeesson_7 Apr 19 '17 at 04:48

2 Answers2

1

This is a known bug in Xcode. Your best option would be to update to Xcode 8.3 and migrate your Swift 2.3 code to 3.1.

Oskar
  • 3,625
  • 2
  • 29
  • 37
1

With Xcode 8, it's highly recommended to use Size classes with universal layout developed using AutoLayout constraints. This helps in designing the user interface to support all iOS device family variants and also supports all device orientations. XIB files should be used as references and using the same UI controls on storyboard UI views.

Gurdev Singh
  • 1,996
  • 13
  • 11