6

Possible Duplicate:
viewDidLoad in NSViewController?

I started development on iOS apps and am now moving to Mac OS X apps. I was wondering if there's an equivalent method in Mac OS X that is like iOS's viewDidLoad to run code after a View Controller launches.

Thank you!

Community
  • 1
  • 1
Mike
  • 61
  • 1
  • 2

1 Answers1

9

From the Apple Release Notes:

Advice for People who Are Looking for -viewWillLoad and -viewDidLoad Methods in NSViewController

Even though NSWindowController has -windowWillLoad and -windowDidLoad methods for you to override the NSViewController class introduced in Mac OS 10.5 does not have corresponding -viewWillLoad and -viewDidLoad methods. You can override -[NSViewController loadView] to customize what happens immediately before or immediately after nib loading done by a view controller.

Evan Mulawski
  • 54,662
  • 15
  • 117
  • 144
  • 1
    I read this in the docs and tried to play around with loadView but still i am not able to understand how it helps in doing something "immediately after nib loading". I have an NSTabView in the xib file which is connected properly but still it is always 0x0 when i keep a breakpoint in loadView. – Chintan Patel Feb 23 '11 at 10:58
  • Never mind, i figured it out. Added my answer to http://stackoverflow.com/questions/3422839/viewdidload-in-nsviewcontroller/5090825#5090825. – Chintan Patel Feb 23 '11 at 12:21