Я пытаюсь добавить фильм в свою ячейку в свой UITableViewCell.View Not Adding to UITableViewCell
Фильм, похоже, играет со звуком, но без визуального. Я думаю, что мне сложно добавить вид filmPlayer в мою камеру.
Посмотрите на мой код:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"FeedCustomCell";
FeedCustomCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
// Configure the cell...
cell.username.text = [NSString stringWithFormat:@"%@", _usernameString];
cell.createdDate.text = [NSString stringWithFormat:@"%@", _createdString];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// First, get the URL for the video file you want to play. For example, if you have an array of the movie file URLs, you'd do this:
FeedCustomCell *cell = [[FeedCustomCell alloc] init];
NSURL *url = [NSURL URLWithString:_videoPathString];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
moviePlayer.controlStyle = MPMovieControlStyleNone;
CGRect previewFrame = CGRectMake(cell.videoView.frame.origin.x, cell.videoView.frame.origin.y, cell.videoView.frame.size.width, cell.videoView.frame.size.height);
moviePlayer.view.frame = previewFrame;
moviePlayer.repeatMode = MPMovieRepeatModeOne;
[cell.videoView addSubview:moviePlayer.view];
[cell.videoView bringSubviewToFront:moviePlayer.view];
[moviePlayer play];
}
Есть идеи?
Im не уверен, но я думаю, вы должны добавить подвид затем воспроизводить видео не наоборот – meda
ли cell.videoView для реально? Если он равен нулю или нет в границах просмотра содержимого ячейки, вы ничего не увидите. – matt