xcode - windowDidLoad() never called using storyboards for mac -


i've played around new mac storyboard-feature included in xcode 6. i've set new os x-project using storyboards , swift, i've created new file mainwindowcontroller.swift, created initializer init(coder: nscoder!) (because otherwise compiler warns me) , hooked in main.storyboard file (set mainwindowcontroller-class windowcontroller in inspector).

everything compiles fine, window specified window content-view opens. code i've written in windowdidload-function never called. let like:

override func windowdidload() {     super.windowdidload()      println("executed") } 

i've tested if initializer called - is.

does has clue? i've never used storyboards intensively on ios before, maybe miss substantial.

in yosemite, nsviewcontroller has been promoted powerful new features make work storyboards. meanwhile, nswindowcontroller got demoted. storyboards, windows no longer loaded nib, windowdidload() doesn't called anymore.

it makes sense window become less important, in favor of more powerful view contains. other answer on page shows how set appdelegate customize window appearance. there's more detail on page here, using appdelegate implement of things might have done in nswindowcontroller.

however, if wanted catch windowdidload() way customize appearance options of window, very easy in interface builder, adding them user defined runtime attributes nswindow object. don't need subclass nswindowcontroller or write code @ all. plug in these values nswindow object via identity inspector pane achieve same effect shown in appdelegate example code:

keypath: titlebarappearstransparent, type: boolean, value: checked keypath: titlevisibility, type: number, value: 1 keypath: stylemask, type: number, value: 32783 

look in headers determine actual numeric values of constants.

( example: nswindowtitlevisibility.hidden = 1 )

of course, can't specify individual bits of stylemask, it's easy enough add them , single number specify style.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -