CollectionView 和旋转问题

Posted

技术标签:

【中文标题】CollectionView 和旋转问题【英文标题】:CollectionView and rotation problems 【发布时间】:2014-02-16 22:24:17 【问题描述】:

我有一个在UICollectionView 上弹出的模态表单视图。在该模态视图中,我将MPMoviePlayerController 嵌入到UIWebView 中。如果您让电影播放器​​全屏显示然后旋转它,则 CollectionView 不会随之旋转。看,当我在视频不是全屏时旋转视图时,我可以看到 CollectionView 更新了视图后面的单元格定位。但是,在播放视频时它不会这样做。知道如何解决这个问题吗?

【问题讨论】:

MPMoviePlayerController 嵌入到UIWebView?向我们展示该代码。 在 ViewDidLoad: NSURL *url = [NSURL URLWithString: self.videoURL]; _moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url]; [[_moviePlayer view] setFrame:[webView bounds]]; [webView addSubview:[_moviePlayer view]]; [_moviePlayer 播放]; 【参考方案1】:

在 ViewDidLoad 中:

NSURL *url = [NSURL URLWithString: self.videoURL];           
_moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url]; 
[[_moviePlayer view] setFrame:[webView bounds]]; 
[webView addSubview:[_moviePlayer view]]; [_moviePlayer play];

【讨论】:

以上是关于CollectionView 和旋转问题的主要内容,如果未能解决你的问题,请参考以下文章