swift - NSViewController story board with coded anchors collapses window -


i'm having trouble mixing story boards , coded autolayout in cocoa + swift. should possible right?

i started nstabviewcontroller defined in story board default settings dragged out of toolbox. added nstextfield view via code. , added anchors. works expected except bottom anchor.

after adding bottom anchor, window , controller seem collapse size of nstextfield. expected opposite, text field stretched fill height of window.

what doing wrong? literal frame maybe? or option flag i'm not setting?

class nstabviewcontroller : wstabviewcontroller {  var summaryview : nstextfield  required init?(coder: nscoder) {     summaryview = nstextfield(frame: nsmakerect(20,20,200,40))     summaryview.font = nsfont(name: "menlo", size: 9)     super.init(coder: coder) }  override func viewdidload() {     self.view.addsubview(summaryview)     summaryview.translatesautoresizingmaskintoconstraints = false     summaryview.topanchor.constraintequaltoanchor(self.view.topanchor, constant: 5).active = true     summaryview.leftanchor.constraintequaltoanchor(self.view.leftanchor, constant: 5).active = true     summaryview.rightanchor.constraintequaltoanchor(self.view.rightanchor, constant: -5).active = true     summaryview.bottomanchor.constraintequaltoanchor(self.view.bottomanchor, constant: -5).active = true } 

to prevent window collapsing set lower priority hugging:

 summaryview.setcontenthuggingpriority(249, fororientation: .vertical) 

but misuse tab view controller. manages views in common use... while adding text tab header area. there tutorial of how use correctly: https://www.youtube.com/watch?v=ts4h3wviwpy


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -