xcode - NSTableView inside NSOutlineView and NSView-Encapsulated-Layout-Height -


i'm building os x application using swift , xcode 6.4 on os x 10.10.5. on specific view of application have view this 1 xcode has on data model editor.

i tried replicate view using outlineview each "row" have title , tableview plus 2 buttons (for plus , minus buttons). tests purposes i've separated title tableview+buttons, this (this 1 of many different attempts).

everything working expected except view has tableview+buttons, never higher 17 pixels. if define in 1 view, have same problem. i've tried defining needed constraints in case there problem constraint seems automatic called nsview-encapsulated-layout-height, forces height 17 pixels:

nslayoutconstraint:0x61800008ea10 'nsview-encapsulated-layout-height' > v:[notestable(17)] (names: notestable:0x60000012e2e0 )

i'm not defining constraint 17 pixels, i've tried testing parameters insert automatic constraints (autoresizessubviews/translatesautoresizingmaskintoconstraints/autoresizingmask) able translate 'special' constraint format , grow doesn't bigger.

tried search web cases encapsulated constraint makes sense , useful.

do know or how can disable constraint or change value height need?

table , outline views on os x not support automatically determining row height dynamic height of cell views. either have explicit static row height, static row height determined design-time height of cell views, or dynamic row height determined delegate , implementation of -tableview:heightofrow: or -outlineview:heightofrowbyitem:.

for case, you're going have implement delegate method. furthermore, delegate method can't query actual cell view because may not exist , outline view need row height before creating it. so, delegate has compute other way.

one way keep standalone view hierarchy of prototypical cell view. when delegate asked row height, configures view hierarchy actual cell view row/item, forces lay out, , queries height. configuring view hierarchy may simple setting objectvalue of top-level view (if it's nstablecellview, control, or otherwise implements setter). if delegate other configuration, such in -outlineview:viewfortablecolumn:item: method, you'll need replicate prototype view hierarchy.

also, when factor affect row's height changes, have call outline view's -noteheightofrowswithindexeschanged: method let know that, re-query ...heightofrow... method.

finally, bare table views not amenable being constrained sibling views or superview. want live in scroll views , continue using springs-and-struts position , size themselves. see my answer question discussion of this. possible has been improved in recent versions of os. anyway, you're going have observe table view's frame-change notifications (and ask post such notifications) in order know when grows. , ability set constraints relate other views in cell view hierarchy severely limited, because need translatesautoresizingmaskintoconstraints turned on.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -