【问题标题】:How can I overlap videos in my iPhone app? [closed]如何在我的 iPhone 应用程序中重叠视频? [关闭]
【发布时间】:2014-02-23 03:52:18
【问题描述】:

我正在寻找一款能够播放可重叠视频的 iPhone 应用。像这样:

我该怎么做?

【问题讨论】:

  • 那么……你尝试了什么?

标签: iphone objective-c


【解决方案1】:

使用UICollectionView

1) 低效方式:如果您想同时播放所有媒体。 媒体播放器的网格视图。

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CollectionCell forIndexPath:indexPath]; // 获取网址 播放器 *mediaPlayer = [[self playerArray]objectAtIndex:indexPath.row]; NSURL* videoURL = [NSURL URLWithString:mediaPlayer.url]; MPMoviePlayerController* mPlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoURL]; [mPlayer 准备播放]; [mPlayer 播放]; //用于部分查看..... [mPlayer.view setFrame:CGRectMake(/*你的框架*/)]; [mPlayer.view.backgroundColor = [UIColor grayColor]; [单元格添加子视图:mPlayer.view]; 返回单元格; }

2) 高效方式:当用户点击单元格时,用缩略图放置网格并用 UIImageview 替换媒体播放器对象(在这种情况下,将上述代码放在 didSelectRow 中)

【讨论】:

    猜你喜欢
    • 2012-04-02
    • 1970-01-01
    • 2011-07-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-25
    • 2012-12-10
    • 1970-01-01
    相关资源
    最近更新 更多