• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Programmatic autolayout problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programmatic autolayout problem


  • Subject: Re: Programmatic autolayout problem
  • From: Kyle Sluder <email@hidden>
  • Date: Mon, 25 Feb 2013 23:03:54 -0800

On Mon, Feb 25, 2013, at 10:46 PM, Rick Mann wrote:
> Well, it's closer to working, but still not correct. If I don't pre-size
> the window, it never gets resized, even though all the constraints are
> above 500. Vertically it seems to be perfectly hugging my labels
> (verified by changing the font size in IB without re-adjusting the views
> in IB). But horizontally it's still not hugging. It looks like the labels
> aren't shrinking horizontally enough.
>
> The fixes space between the two labels also isn't the 5 it's specified to
> be.
>
> Frame: {{288, 0}, {96, 16}}
> view1: {{2, 1}, {34, 14}}
> view2: {{35, 1}, {59, 14}}
>
> Seems to be -1, for some reason.

You must still have an underspecified system of constraints in the
horizontal direction. Unfortunately, your description of your constraint
system lacks sufficient detail for debugging, which is already difficult
to do in textual form.

Graphics really are the best. You can use -[NSView
constraintsAffectingLayoutForOrientation:] to get an array of all(*) the
constraints determining a view's layout in that direction. Pass that
array to -[NSWindow visualizeConstraints:] and you get a big pink debug
window attached to your own, and all the constraints you passed will be
drawn on top of your window. If your layout is ambiguous, there will be
an "Exercise Ambiguity" button you can click to help you figure out
what's missing.

(*) It's not guaranteed to return all the constraints. But I've yet to
see it fail to return a constraint.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Programmatic autolayout problem
      • From: Rick Mann <email@hidden>
    • Re: Programmatic autolayout problem
      • From: Rick Mann <email@hidden>
References: 
 >Programmatic autolayout problem (From: Rick Mann <email@hidden>)
 >Re: Programmatic autolayout problem (From: Kyle Sluder <email@hidden>)
 >Re: Programmatic autolayout problem (From: Rick Mann <email@hidden>)
 >Re: Programmatic autolayout problem (From: Kyle Sluder <email@hidden>)
 >Re: Programmatic autolayout problem (From: Rick Mann <email@hidden>)

  • Prev by Date: Re: Programmatic autolayout problem
  • Next by Date: Re: Programmatic autolayout problem
  • Previous by thread: Re: Programmatic autolayout problem
  • Next by thread: Re: Programmatic autolayout problem
  • Index(es):
    • Date
    • Thread