用户点击完成退出全屏后重新显示视频缩略图 - 目标C.

时间:2016-05-12 14:18:31

标签: ios objective-c uitableview

我有一个使用UITableView的时间轴来显示视频缩略图。用户可以点击视频缩略图图像,然后打开全屏视频并播放。当用户点击完成按钮时,用户返回时间线。现在视频缩略图消失了,用户看到了他们正在观看的视频和他们离开的地方。我希望它在用户点击完成按钮的位置,然后将它们带回时间线,并在播放全屏视频之前显示视频缩略图。以下是一些代码:

        cell.imageView.image = [UIImage imageNamed:@"PlaceholderPhoto"];

        if (object) {

            //The below line displays the users video thumbnail on the timeline.
            //The following 2 lines is what fills the display cell that shows the photo.
            cell.imageView.clipsToBounds = YES;
            cell.imageView.contentMode = UIViewContentModeScaleAspectFill;

            //The below line is what displays the video thumbnail on the home timeline.
            cell.imageView.file = [object objectForKey:@"videoThumbnail"];
            [cell.imageView loadInBackground];

            PFFile *video =[object objectForKey:@"file"];
            [video getDataInBackgroundWithBlock:^(NSData *data, NSError *error) {
                if (!error) {
                    NSString *string = [NSString stringWithFormat:@"cell%li.m4v", (long)cell.mediaItemButton.tag];
                    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
                    NSString *documentsDirectory = [paths objectAtIndex:0];
                    NSString *appFile = [documentsDirectory stringByAppendingPathComponent:string];
                    [data writeToFile:appFile atomically:YES];
                    NSURL *movieUrl = [NSURL fileURLWithPath:appFile];
                    //The below line is what displays the full size movie and plays it on the home timeline.
                    [cell.movie setContentURL:movieUrl];
                }
            }];

        }
        return cell;

1 个答案:

答案 0 :(得分:0)

我能够通过将此行添加到mpmovieplayer完成按钮来实现:

[self.tableView reloadData];