• 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: Width defining NSLayoutConstraint zero
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Width defining NSLayoutConstraint zero


  • Subject: Re: Width defining NSLayoutConstraint zero
  • From: Jonathan Mitchell <email@hidden>
  • Date: Thu, 10 Apr 2014 19:37:52 +0100

On 10 Apr 2014, at 17:09, Kyle Sluder <email@hidden> wrote:

> On Apr 10, 2014, at 6:25 AM, Jonathan Mitchell <email@hidden> wrote:
>>
>> On some occasions I want my controls to collapse and set a width defining constraint constant to zero.
>
> In general, views should not be resized to zero width or height. A lot of times things will break internally (divide by zero errors or visual artifacts). This was even more likely in the days of springs and struts, when shrinking a view to zero width/height meant -resizeWithOldSuperviewSize: lost all the information necessary to apply springs and struts.
Thinking about this point again and I don’t think it holds up.

Autolayout can easily drive a view to be of zero size.
A view that doesn’t contain sufficient internal constraints (or an intrinsic size) to define an unambiguous frame returns 0,0 for its -fittingSize.
Indeed, when adding views to a NSStackView one of the most common issues is that the subview collapses to zero because its -fittingSize is returning 0,0.

J
_______________________________________________

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: Width defining NSLayoutConstraint zero
      • From: Kyle Sluder <email@hidden>
References: 
 >Width defining NSLayoutConstraint zero (From: Jonathan Mitchell <email@hidden>)
 >Re: Width defining NSLayoutConstraint zero (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: Width defining NSLayoutConstraint zero
  • Next by Date: Re: Width defining NSLayoutConstraint zero
  • Previous by thread: Re: Width defining NSLayoutConstraint zero
  • Next by thread: Re: Width defining NSLayoutConstraint zero
  • Index(es):
    • Date
    • Thread