开发者

doesn't return windows

I need to add a view to window on iPhon开发者_如何学Ce, 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.


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.


You could do something like this.

UIView *controllersView = [myViewController view];

[window addSubview:controllersView];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜