0

https://stackoverflow.com/a/28334583/4107801

I tried the method mentioned in this answer but it crashes with bad access every time.

Maybe the private APIs have changed or I'm simply implementing it incorrectly. Here is my implementation:

override func loadView() {
    view.frame = CGRect(origin: CGPoint(x: 100, y: 100), size: CGSize(width: 1000, height: 1000))
    //view = self.view
    splitView = NSSplitView(frame: view.frame)
    splitView?.autoresizingMask = .ViewWidthSizable | .ViewHeightSizable
    splitView?.setPosition(300, ofDividerAtIndex: 0)
    view.addSubview(splitView!)
}
Community
  • 1
  • 1
Jacky Wang
  • 618
  • 7
  • 27

1 Answers1

1

LoadView doesn't init the contentView in the controller so you have to do that manually too.

Adding

view = NSView(frame:CGRect(origin: CGPoint(x: 100, y: 100), size: CGSize(width: 1000, height: 1000)))

solved the problem.

Jacky Wang
  • 618
  • 7
  • 27