2

我想在按下停止视频捕获按钮后打开新的视图控制器。我正在使用此代码,但我无法执行此操作。

-(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];




         }

    }

按下停止捕获视频按钮后,我想导航到另一个视图。

4

2 回答 2

2

您已经展示了图像选择器,presentModalViewcontroller因此您无法调用[self.navigationController pushViewController:test animated:YES];图像选择器。你有两个选择一个很简单

1)而不是调用[self dismissModalViewControllerAnimated:YES];图像选择器,只需调用

   nextviewcontroller *test=[[nextviewcontroller alloc]init];
   [self presentModalViewController:nextviewcontroller animated:YES];

2)使用委托来调用新的视图控制器。

于 2012-05-18T16:37:16.377 回答
0

如果您使用延迟时间为 0.2 的 performSelector 是可能的......这里只需调用该方法及其工作正常,在方法中您可以推送您的 nextViewController....希望这对您有所帮助... :)

于 2012-05-18T17:05:41.953 回答