title: Autolayout problems with iOS8 with code that works fine on iOS7
body: <p>I'm in the midst of developing an app for the iPhone and iPad.  It supports iOS6 and iOS7 and it uses auto layout exclusively.  </p>
  
  <p>This past week, when Apple announced that iOS8 was ready for prime-time, I upgraded one of my iPhones and an iPad both to iOS8.  I also bumped my XCODE up to version 6.  I have 2nd iPhone which I left at iOS7.</p>
  
  <p>I generated new executables with Xcode 6 and I was distressed to see that their screen layouts were messed up when executed on my devices running iOS8 but still fine on iOS7.  This is true on both my physical devices and on Xcode's emulators.</p>
  
  <p>It took a lot of digging but I'm pretty clear now on what's happening though I don't know why.</p>
  
  <p>Specifically, certain auto layout operations are failing for me on iOS8 but they are fine on iOS7.</p>
  
  <p>Some examples involving a button which I am placing on an underlying view whose size is equal to the size of the screen:</p>
  
  <p>(1) If I ask auto layout to position the button's horizontal center (CX) equal to the underlying view's horizontal center, the result is that the button's horizontal center is placed on the underlying view's left edge.</p>
  
  <p>(2) If I ask auto layout to to make the width of the button equal to 50% of the width of the underlying view, it gives it no width at all.</p>
  
  <p>I am able to work around these issues as follows:</p>
  
  <p>(1) I ask auto layout to position the button's center equal to the underlying view's left edge plus 50% of the screen's width.</p>
  
  <p>(2) I ask auto layout to make the button's width equal to 50% of the screen's width.</p>
  
  <p>I am slowly clawing my way, with workarounds like these, back to auto layout code that works for me on both iOS7 and iOS8.  But I am really wondering what's going on here.</p>
  
  <p>It looks like auto layout cannot determine the size of the underlying view and so auto layout calculations that require that information fail.  But it does know where the top and left edges of the view are so calculations based on those data succeed.</p>
  
  <p>This is a large app and I've written many hundreds of lines of auto layout code for iOS6 and iOS7 that work perfectly for me.</p>
  
  <p>I've been tweaking and trying things now with iOS8 for three days and I'm no wiser than I was when I began.</p>
  
  <p>Anyone have any suggestions or thoughts as to what might be the issue here?</p>