开发者

MPMoviePlayerController view vanishes on Presenting a modal View Controller

My view hierarchy containing the view from a MPMoviePlayerController vanishes the moment I present a Modal View Controller.

Instead of displaying a view with a movie and controls it depicts an earlier subview beneath it. I checked the subview array of the main view contr开发者_如何学Coller and all views including the movie player view exits.

Forcibly adding the movie player view after the modal view controller is done does not bring movie player view back on top.

Would welcome any suggestions/thoughts ?


your problem isn't specific to the MPMoviePlayerController. any time you present a modal view controller, all of the views from other view controllers beneath it disappear.

try it out with just a couple of simple view controllers.

in the app delegate, set your window background color to red:

[self.window setBackgroundColor:[UIColor redColor]];

then add a view controller with a green background:

UIViewController *vc = [[UIViewController alloc] init]; [[vc view] setBackgroundColor:[UIColor greenColor]]; self.window.rootViewController = vc;

finally, create another view controller with a transparent background, and present it modally:

UIViewController *vc2 = [[UIViewController alloc] init]; [[vc2 view] setBackgroundColor:[UIColor clearColor]]; [vc presentModalViewController:vc2 animated:YES];

you'd expect to see the green VC through the clear VC, but instead you see red (ie, you see the window).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜