Reputation: 628
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!)
}
Upvotes: 1
Views: 1182
Reputation: 628
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.
Upvotes: 1