On Thu, Apr 10, 2014, at 11:37 AM, Jonathan Mitchell wrote: > > On 10 Apr 2014, at 17:09, Kyle Sluder <k...@ksluder.com> wrote: > > > On Apr 10, 2014, at 6:25 AM, Jonathan Mitchell <li...@mugginsoft.com> 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.
It is true that auto layout does not prevent views from going to (0,0). It is also true that many views—system-provided or otherwise—fail spectacularly if resized to this size. --Kyle Sluder _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com