• 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 22:38:20 -0800

On Mon, Feb 25, 2013, at 10:04 PM, Rick Mann wrote:
> IB defaults a lot of hugging/compression constraints to 250. Do I need to
> increase those to 501 or more, as well?

Yes for the hugging constraints. Otherwise the window size will win as
the user drags to resize the window.

Think of window drag-resizing as installing a temporary constraint that
follows the mouse at priority 500. Think of content hugging as
installing an equality constraint with a constant equal to the view's
intrinsicContentSize in the given dimension, operating at the priority
you specify. If the content hugging priorities of your text fields have
higher priority than the window-resizing constraint, the hugging
constraints will win and the window frame will stay put.

Note that the window itself won't notice this outside of a drag
operation, so it will still put up the drag-to-resize cursor when the
mouse gets near the window edge. If you know you want the window to stay
a fixed size, you'll probably want to turn off the Resizable flag for
your window. Auto layout should still resize the window appropriately.

(Content compression resistance is different from content hugging
because compression resistance is an inequality, whereas hugging is an
equality. Inequalities have infinite solutions, so it's easier to
accidentally underspecify your constraint system once you start
incorporating them.)

--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>
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>)

  • 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