我想在按下停止视频捕获按钮后打开新的视图控制器。 我正在使用此代码,但我无法做到这一点。
-(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];
}
}
在按下停止捕捉视频按钮后,我想导航到另一个视图。
答案 0 :(得分:2)
您已按presentModalViewcontroller
展示了图片选择器,因此您无法在图像选择器上调用[self.navigationController pushViewController:test animated:YES];
。你有两个选择,一个很简单
1)不要在图像选择器上调用[self dismissModalViewControllerAnimated:YES];
,而只需调用
nextviewcontroller *test=[[nextviewcontroller alloc]init];
[self presentModalViewController:nextviewcontroller animated:YES];
2)使用代理人来调用新的视图控制器。
答案 1 :(得分:0)
如果你使用延迟时间0.2接近于......的performSelector,这是可能的。这里只需调用方法,它的工作正常 在方法中你可以推你的nextViewController .... 希望这能帮到你...... :)