我想在按下停止视频捕获按钮后打开新的 View Controller 。 我正在使用这段代码,但我无法做到这一点。
-(void)shootvideo
{
UIImagePickerController *imagePicker =
[[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie, nil];
[self presentModalViewController:imagePicker animated:YES];
}
-(void) imagePickerController: (UIImagePickerController *) picker
didFinishPickingMediaWithInfo: (NSDictionary *) info
{
NSString *mediaType = [info objectForKey: UIImagePickerControllerMediaType];
if (CFStringCompare ((__bridge CFStringRef) mediaType, kUTTypeMovie, 0)
== kCFCompareEqualTo)
{
NSString *moviePath = [[info objectForKey:UIImagePickerControllerMediaURL] path];
NSURL *videoUrl=(NSURL*)[info objectForKey:UIImagePickerControllerMediaURL];
if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum (moviePath)) {
UISaveVideoAtPathToSavedPhotosAlbum (moviePath, nil, nil, nil);
}
}
[self dismissModalViewControllerAnimated:YES];
// nextviewcontroller *test=[[nextviewcontroller alloc]init];
//[self.navigationController pushViewController:test animated:YES];
}
}
按下停止捕获视频按钮后,我想导航到另一个 View 。
最佳答案
您已经通过 presentModalViewcontroller
呈现了图像选择器,因此您无法在图像选择器上调用 [self.navigationController PushViewController:testanimated:YES];
。您有两种选择,一种是简单的
1) 无需在图像选择器上调用 [selfmissModalViewControllerAnimated:YES];
,只需调用
nextviewcontroller *test=[[nextviewcontroller alloc]init];
[self presentModalViewController:nextviewcontroller animated:YES];
2) 使用委托(delegate)调用新的 View Controller 。
关于iPhone:从相机捕获视频后打开新的 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10656334/