Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Beginning iPhone Development with Swift - Chapter 03 - Autolayout question

Hi All,

I am having an issue with AutoLayout within this chapter, hopefully someone can point me in the right direction.

Page 78 in the Physical book: I have followed the steps of adding the left constraint and the right one. However once go to fix the "Frame for left & right run time" warning, using the Update Frames. My right button shifts past the right edge of the view.

screenshot Below:

image


Thanks for the help!

Comments

  • I had this same problem. I ended up using -32 as the constraint value and that worked for me.
  • edited January 2015
    I too have this problem - I too find -32 provides a gap similar to the Left button (although the left one did change itself back to 0 a some point and I had to reset).  My thought would be that -32 is needed as this is less than (inside) the margin rather 32 being beyond the margin? 

    Not too clear but could be a bug or just a typo in the book???
  • For some strange reason the book screenshot has an option that says "Prefer margin to relative" which I have'nt seen before in my version of Xcode (6.1.1).  In my version the option is "Constrain to margin" which I believe may be the key to this issue.

    You need to apply the constraint with the "Constrain to margin" box CHECKED, the left horizontal bar SOLID and the number offset set to ZERO (because you are constraining the button to the MARGIN".  If you are just setting the constraint for one control then also set the "Update Frames" checkbox to "Items of new Constraints" before adding the constraint.

    I had the same problem as jonathanjacob so I hope this helps.

    Regards

    brunothedog
  • I had the same problem. I used the brunothegog proposition that seems, at least for me, the right solution.
    Regards
    Bernie.
  • I'm completely new to this and am using xCode v6.3.1, as downloaded from the developers area. In working the app in Chapter 3 of the book, I followed the discussion in the book and my app's label and buttons appeared just fine in the Simulator. I used 32 for the left and right button constraints....and it looks fine. FWIW

    I'm about to tackle the app in chapter 4, and it looks to be quite involved.

    I'm very happy to have joined this forum. Maybe sometime I'll be able to contribute something that will help someone. In the meantime, I'm learning from everyone here. Thanks for your inputs.

    Rich
Sign In or Register to comment.