简体   繁体   English

摄像机图像捕获后导航栏未显示

[英]Nav Bar not showing after camera image capture

I have been updating an app that I had some else build for me. 我一直在更新一个为我自己构建的应用程序。 In the updating, I am instituting storyboard segues, among other things, and have got the app almost complete. 在更新中,除其他外,我正在设置情节提要剧集,并使该应用程序接近完成。 One little niggling issue is when I take an picture with the camera and the image is presented in the TakenImageView, the NavBar is not visible. 一个小问题是,当我用相机拍摄图片并且图像显示在TakenImageView中时,导航栏不可见。 Yet, if I go from the gallery to the TakenImageView, the NavBar shows! 但是,如果我从图库转到TakenImageView,则会显示NavBar! Ugh. 啊。 The image picker is presented from the HomeView, then moves to TakenImage after the user chooses camera or gallery. 图像选择器从HomeView呈现,然后在用户选择相机或画廊后移至TakenImage。 I have tried to change to a prepare and perform Segue, but the segue doesn't fire from the gallery when selecting an image or from the camera's UsePhoto. 我试图更改为准备并执行Segue,但是在选择图像或从相机的UsePhoto时,segue不会从图库中触发。 The only way I can get the image to the TakenImageView is to manually segue via instantiating the view in code. 我可以将图像获取到TakenImageView的唯一方法是通过实例化代码中的视图手动进行筛选。 See below... 见下文...

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info;
{
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    TakenImageVC *takenVC = [storyboard instantiateViewControllerWithIdentifier:@"TakenImageVC"];
    takenVC.takenimage = [info objectForKey:UIImagePickerControllerOriginalImage];
    [picker pushViewController:takenVC animated:YES];
    //_pickerImage = [info objectForKey:UIImagePickerControllerOriginalImage];
    //[self performSegueWithIdentifier:@"TakenSegue" sender:self];
}

The prepare for segue has only these three. 进行准备的准备只有这三个。 The top two are modal and are linking from the buttons. 前两个是模态的,并通过按钮链接。 The TakenSegue is linking from the controller. TakenSegue正在从控制器链接。 Of course, I have the destinationController commented out, as the segue doesn't fire when using perform as noted earlier. 当然,我已经注释掉了destinationController,因为如前所述,在使用perform时segue不会触发。

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:@"InfoSegue"])
    {
        NSLog(@"Info Modal view");
    }
    if ([segue.identifier isEqualToString:@"HelpSegue"])
    {
        NSLog(@"Help Modal view");
    }
    if ([segue.identifier isEqualToString:@"TakenSegue"])
    {
        NSLog(@"Taken Segue");
        //TakenImageVC *takenVC = segue.destinationViewController;
        //takenVC.takenimage = _pickerImage;
    }
}

In trying different methods, I have added a NavigationController between the HomeView and TakenImageView and have changed the class to UIImagePickerController in the attributes. 在尝试不同的方法时,我在HomeView和TakenImageView之间添加了NavigationController,并将属性中的类更改为UIImagePickerController。 Still, the NavBar doesn't show... but only after taking a photo with the camera! 导航栏仍然不会显示...而是仅在使用相机拍照后显示! And, yes, I have the navigation bar set to not hide... in both the HomeView and TakenView. 而且,是的,我在HomeView和TakenView中都将导航栏设置为不隐藏...。 This is in the viewWillAppear of both controllers. 这在两个控制器的viewWillAppear中。

Target is iOS7.1 and up. 目标是iOS7.1及更高版本。 Running Xcode 7. 运行Xcode 7。

I'd appreciate some help from anyone with a hint as to what is causing the nav bar to not show from the camera and, of course, a way to fix it! 非常感谢任何人的帮助,这些提示暗示了什么导致导航栏无法从相机中显示出来,当然,还有一种解决方法! Thanks! 谢谢!

I was unable to get the next view to show with a nav bar after the camera, even after trying numerous scenarios. 即使尝试了多种场景,我也无法通过相机后的导航栏显示下一个视图。 So, after seeing a hint in a different post, I removed the nav controller between the home and taken view, changed the attributes to none for Simulated Metrics/Top Bar and inserted a toolbar in it's place in the TakenView and two following views. 因此,在看到其他帖子中的提示后,我删除了主视图和采用视图之间的导航控制器,将“模拟指标/顶部栏”的属性更改为“无”,并在TakenView和以下两个视图中插入了一个工具栏。 Yes, it required more work in Storyboard and I had to add a label where the title should go, but it is all functioning. 是的,它需要在Storyboard中进行更多工作,我不得不在标题应添加的位置添加标签,但是所有标签都可以使用。 And, I didn't have to add any more code, except for changing the back or cancel buttons into unwindSegues. 而且,除了将后退或取消按钮更改为unwindSegues之外,我无需添加任何其他代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM