Re: Custom layout and constraints

2014-09-24 Thread Allan Odgaard
On 21 Sep 2014, at 18:18, Ken Thomases wrote: On Sep 21, 2014, at 9:10 AM, Allan Odgaard lists+cocoa-...@simplit.com wrote: The problem seems to be that `layoutSubtreeIfNeeded` calls `resizeWithOldSuperviewSize:` (using the containing view’s size), but regardless of what’s passed to the

Re: Custom layout and constraints

2014-09-24 Thread Allan Odgaard
On 21 Sep 2014, at 22:51, Allan Odgaard wrote: 4. If allowsImplicitAnimation is enabled then my custom layout implementation is called a dozen times after the first (true) layout pass. This is problematic because then I’ll do layout (again) and effectively suppress the animation (although

Custom layout and constraints

2014-09-21 Thread Allan Odgaard
I am overriding `NSView`’s `layout` method to manually place one of my subviews. I can set the frame for this subview, and it works until someone calls `layoutSubtreeIfNeeded` on the subview (which sometimes happens automatically during display). The subview’s `needsLayout` property is `NO`

Re: Custom layout and constraints

2014-09-21 Thread Kyle Sluder
On Sep 21, 2014, at 7:10 AM, Allan Odgaard lists+cocoa-...@simplit.com wrote: That is, if the view has hugging and/or intrinsic content size then the size from the derived constraints will be used, otherwise `NSZeroSize`. Likewise the origin will be `NSZeroPoint` unless constrains are

Re: Custom layout and constraints

2014-09-21 Thread Allan Odgaard
On 21 Sep 2014, at 16:44, Kyle Sluder wrote: […] how can I ensure the position I set for a subview’s frame in my `layout` override is not (implicitly) changed later? You need to turn on translatesAutoresizingMaskIntoConstraints for the subviews you position manually. That way Auto Layout

Re: Custom layout and constraints

2014-09-21 Thread Ken Thomases
On Sep 21, 2014, at 9:10 AM, Allan Odgaard lists+cocoa-...@simplit.com wrote: I am overriding `NSView`’s `layout` method to manually place one of my subviews. The problem seems to be that `layoutSubtreeIfNeeded` calls `resizeWithOldSuperviewSize:` (using the containing view’s size), but