osx - Init NSViewController without nib -
https://stackoverflow.com/a/28334583/4107801
i tried method mentioned in answer crashes bad access every time.
maybe private apis have changed or i'm implementing incorrectly. here 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!) }
loadview doesn't init contentview in controller have manually too.
adding
view = nsview(frame:cgrect(origin: cgpoint(x: 100, y: 100), size: cgsize(width: 1000, height: 1000)))
solved problem.
Comments
Post a Comment