Dinesh Kaushik
Dinesh Kaushik

Reputation: 2987

iPhone: Use apple sample code AVCam to open new view controller after capturing video

I am using the apple sample code AVCam for capturing video

But i want to navigate to another view after pressing stop capturing video button

But i am unable to do this

Please suggest me the proper way to do this task

I am doing the follwing coding in AVCam sample code method

- (void)captureManagerRecordingFinished:(AVCamCaptureManager *)captureManager
{
    CFRunLoopPerformBlock(CFRunLoopGetMain(), kCFRunLoopCommonModes, ^(void) 
    {

        [[self recordButton] setTitle:@"Record"];
        [[self recordButton] setEnabled:YES];

    });

    [self dismissModalViewControllerAnimated:YES];

    NextViewController *test=[[NextViewController alloc]init];
    [self.navigationController pushViewController:test animated:YES];

}

Please tell me where i am going wrong or any other way to do this task

Upvotes: 4

Views: 709

Answers (1)

Radu Lucaciu
Radu Lucaciu

Reputation: 706

AVCam does not implement a NavigationController out of the box so pushing view controllers will not work.

However, it's not hard to do it

Open MainWindow.xib Add a navigation Controller item just bellow Window and make sure that Cam View Controller is a child of the Navigation Controller - see the following image: enter image description here

Right click on the Window item and make sure the rootViewController item is linked to the NavigationController, not to the Cam View Controller enter image description here

Compile and run - pushing the view controller should now work.

Upvotes: 2

Related Questions