When to create subviews in custom NSView


Steve Mills
 

I'm needing to create a custom NSView that will layout a grid of other NSViews, and none of the builtin classes will work well for all my needs. What I'm having a really hard time figuring out is exactly when I should create the subviews and when to install their constraints. The subviews will need to be re-created any time the number of rows/cols changes or by other such changes. Is viewWillDraw the right place to create them? Also, I've overridden updateConstraintsForSubtreeIfNeeded, which installs all the constraints on the subviews, but it's never being called.

--
Steve Mills
Drummer, Mac geek

Join cocoa@apple-dev.groups.io to automatically receive all group messages.