简体   繁体   中英

What is the equivalent of viewWillAppear for NSDocument

I have a NSDocument based application with a nib that represents the visual document. As soon as the view Appeared I want to trigger some actions.

For a "normal" UIViewController I would simply override viewDidAppear: . However, NSDocument does not have this method, even though it has a view per document.

NSDocument offers
-(void)windowControllerDidLoadNib:(NSWindowController *)aController; method.
I think this is what you are looking for.
The document window controllers are still accessible using NSDocument 's windowControllers method.

If you have more precise requirements on window appearing/disappearing, becoming key, etc..., you could handle that with window notifications , or window delegation system .

-[NSDocument showWindows] ,可以在末尾添加一些自定义逻辑。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM