Search code examples
macoscocoanssplitviewcontroller

How to fix the postion of splitDividerView in NSSplitViewController


How to fix the postion of splitDividerView in NSSplitViewController I had been search for years,but it doesn't work.Please help,Thanks! Once this app start,the left view width is 150,but still i can resize both of the left and right view by dragging the splitDividerView. I have attatached a screenshot for reference

override func viewDidLoad() {
        super.viewDidLoad()
        self.splitView.wantsLayer = true
        self.splitView.setPosition(150, ofDividerAt: 0)

    }

screenshot for reference


Solution

  • I add two container view which is use for managing NSViewController , so get rid of NSSplitView and will save you hours ScreenShot for Reference