我有一个表格视图,列出了锻炼中的练习。当您按下单元格时,它会在IOS视频播放器中启动练习视频。我还有一个Detail Disclosure按钮,显示一个微调器,其中包含有关该练习的各种信息,包括播放视频的选项。
如果您通过在微调器中选择“播放视频”来播放视频,并在视频播放器上单击“完成”,则会将包含练习的表视图推回(这是正确的)。
但是,如果您按下练习单元启动视频并按“完成”按钮,它会跳回到主视图。
这是我的PlayVideo功能:
-(void) playMovieAtURL:(NSURL*)theURL {
MMRMovieViewController *mp = [[MMRMovieViewController alloc] initWithContentURL:theURL];
[mp shouldAutorotateToInterfaceOrientation:YES];
self.moviePlayer = mp;
[self presentMoviePlayerViewControllerAnimated:self.moviePlayer];
}
这是我的选择器didSelectRow代码:
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
// Handle Selection
NSLog( @"Index: %d", row ) ;
NSString *SelectedContent = [contentSelectionOptions objectAtIndex:row];
self.contentSelectionTitle = SelectedContent;
[self hidePickerView];
if( [SelectedContent isEqualToString:@"View Animation"] ) {
//[self performSegueWithIdentifier:@"cntPlayAnimation" sender:self];
NSInteger eindex = [self.accessoryButtonTapIndex indexAtPosition:1];
//NSIndexPath *selectedIndexPath = [self.tableView indexPathForSelectedRow];
//NSInteger eindex = [selectedIndexPath indexAtPosition:1];
Exercise* tmpExercise = [self.exercises objectAtIndex:eindex];
//tmpExercise = [self.exercises objectAtIndex:eindex];
NSURL* exerciseURL = [NSURL URLWithString:tmpExercise.animation];
[self playMovieAtURL:exerciseURL];
} else {
[self performSegueWithIdentifier:@"cntExerciseContent" sender:self];
}
}
这是我的表didSelectRow:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//[self showPickerView:indexPath];
NSIndexPath *selectedIndexPath = [self.tableView indexPathForSelectedRow];
NSInteger eindex = [selectedIndexPath indexAtPosition:1];
Exercise* tmpExercise = [self.exercises objectAtIndex:eindex];
//tmpExercise = [self.exercises objectAtIndex:eindex];
NSURL* exerciseURL = [NSURL URLWithString:tmpExercise.animation];
[self playMovieAtURL:exerciseURL];
}
无论视频是如何发起的,都需要发生什么,当您点击“完成”按钮时,它会带您回到表格视图。
由于