ios YTPlayerView不响应触摸

时间:2015-11-05 09:34:43

标签: ios objective-c iphone youtube uicollectionview

我有YTPlayerView的问题,我创建了一个集合视图,并在每个单元格中添加了子视图YTPlayerView,问题是它显示效果很好,但是没有响应按下视图等。

当视频播放完毕时,不在缩略图页面上工作。 How it's looking.     #pragma mark UICollectionView

-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return self.dataSource.count;
}

-(UICollectionViewCell*)collectionView:(UICollectionView *)collectionView
            cellForItemAtIndexPath:(NSIndexPath *)indexPath{

YTCollectionViewCell* cell = [collectionView dequeueReusableCellWithReuseIdentifier:self.identifierDataSource[indexPath.row]
                                                                       forIndexPath:indexPath];
if (!cell) {
    cell = [YTCollectionViewCell new];
}
if (!cell.loaded) {
    [cell.playerView loadWithVideoId:self.dataSource[indexPath.row]];
    cell.loaded = YES;
}
return cell;}

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
return CGSizeMake(self.view.bounds.size.width, self.view.bounds.size.height);
}

-(void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath{
YTCollectionViewCell* ycell = (YTCollectionViewCell*)cell;
[ycell.playerView stopVideo];}

-(void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath{
YTCollectionViewCell* ycell = (YTCollectionViewCell*)cell;

if (!ycell.loaded) {
    [ycell.playerView loadWithVideoId:self.dataSource[indexPath.row]];
    ycell.loaded = YES;
}else{
//[ycell.playerView playVideo];
}
}

`

0 个答案:

没有答案