I spent time searching this without much success (including documentation), still left puzzled the didMoveToWindow:
method.
Using didMoveToWindow:
in a stock view project template:
-(void)didMoveToWindow{
[super didMoveToWindow];
// do something
}
gives the following warning:
Warning: 'UIViewController' may not respond to 'didMoveToWindow'
It is not called on start up of view which is a surprise.
How will this method be called?
In a UIViewController, you probably want viewDidAppear.
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/viewDidAppear:
didMoveToWindow
is a method ofUIView
, notUIViewController
.