I need to add a view to window on iPhone, so i tried to do this: [[UIApplication sharedApplication] windows]
, but it seams that the array contains only one window.
Can anyone tell me what i'm not doing write/what i need to do?
I need to add a view to window on iPhone, so i tried to do this: [[UIApplication sharedApplication] windows]
, but it seams that the array contains only one window.
Can anyone tell me what i'm not doing write/what i need to do?
try
[[UIApplication sharedApplication] keyWindow];
if you want to find your app's window.
Your AppDelegate class will hold the window (as a property). You only get one window per application. In most cases you should only add views directly to the window from the AppDelegate -- for normal subview management, use viewControllers.
You could do something like this.
UIView *controllersView = [myViewController view];
[window addSubview:controllersView];
Well, I found the problem. Actually conditions where not set correct, [[UIApplication sharedApplication] windows]
returned only one window. Still, [[UIApplication sharedApplication] keyWindow]
throw an exception.
It was because When MPVideoPlayerController
starts playing, it starts creating a new window, but, probably does not finish this job immediately. It is created ALMOST immediately, but not immediately.