故事板导航从普通视图导航到NavigationViewController

时间:2014-10-16 08:24:58

标签: ios objective-c xcode xcode6

我有一个普通的ViewController我想在我的 NavigationViewController 中导航,这个 NavigatioViewController 可以捕捉照片,但我收到黑屏:

@interface OtherCollectionViewController ()

-(void)add
{
    TakePhotoViewController* takePhoto=[[TakePhotoViewController alloc]init];
    [self presentViewController:takePhoto animated:YES completion:nil];




}

TakePhotoViewController嵌入 NavigationViewController 并检查设备是否有摄像头,通过Xcode导航效果很好。

1 个答案:

答案 0 :(得分:0)

您正在从TakePhotoViewController创建一个新实例。如果您正在使用Storyboard,请使用NavigationController中的Storyboard ID。

- (void)add
{
    UINavigationController *yourNavigationController = (UINavigationController *)[self.storyboard instantiateViewControllerWithIdentifier:@"YourNavigationControllerStoryboardID"];
    [self presentViewController:yourNavigationController animated:YES completion:nil];
}

全部