1

I am using .xib files in my app and I am using xcode5.

If I run my app in iOS6 and earlier, the alignments are missing.

Any one know about this issue?
Do we have to create separate .xib files for iOS7 and iOS6?

EDIT: I turned off Autolayout but under iOS6, the views are still going down by 20 pixels.

staticVoidMan
  • 19,275
  • 6
  • 69
  • 98
Sudhakar Tharigoppula
  • 2,857
  • 3
  • 16
  • 17

2 Answers2

4

If you haven't done so already, turn off AutoLayout in your xib files. Autolayout only came in with iOS 6 and newer iOS versions.

Also, you can preview what XIB files look like between iOS 6 and iOS 7 via a popup menu in the File Inspector:

File Inspector in Interface Builder

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
3

in iOS7, the app windows starts from y=0px (in iOS6-, it begins at y=20px).

The quickest and easiest way to handle this, (and since you're already using Xcode5), is to switch off Autolayout and utilize the iOS6/7 Delta values for every view.

Basically:

  • Select every viewController's main view and uncheck "Use Autolayout"
  • Select every subView (UIButton, UILabel etc), go to the frame setting section
    1. Increase their Y frame values by 20
      • but it seems you, @SudhakarTharigoppula, don't need to do this step.
        ...just do the next step
    2. Enter a value of -20 for ΔY

This will start your app by leaving 20px in iOS7 but back in iOS6, the ΔY of -20px will compensate for the extra 20px you had given to every subView.

see: Status bar and navigation bar issue in IOS7

Community
  • 1
  • 1
staticVoidMan
  • 19,275
  • 6
  • 69
  • 98