Reputation: 2987
I want to open new view controller just after pressing stop video capturing button. I am using this code but i am unable to do this.
-(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];
}
}
Just after pressing the stop capturing video button I want to navigate to another view.
Upvotes: 2
Views: 1231
Reputation: 20541
its possible if you use performSelector with Delay time 0.2 near about ....here just call the method and its work fine and in method you can push your nextViewController.... hope this help you... :)
Upvotes: 0
Reputation: 4257
You have presented the image picker by presentModalViewcontroller
so you cant call [self.navigationController pushViewController:test animated:YES];
on image picker. You have two options one is simple
1) Instead of calling [self dismissModalViewControllerAnimated:YES];
on image picker, just call
nextviewcontroller *test=[[nextviewcontroller alloc]init];
[self presentModalViewController:nextviewcontroller animated:YES];
2) Use delegates to call new view controller.
Upvotes: 2