[英]How to use a UIImagePickerController with UINavigationController
I've browsed the different similar questions here but couldn't find anything useful for my problem. 我在这里浏览了其他类似的问题,但找不到对我的问题有用的任何东西。 What I'm struggling with is quite simple but I can't figure it out.
我正在努力的事情很简单,但我无法弄清楚。
I'm using Xcode 4.6.2 and Storyboarding. 我正在使用Xcode 4.6.2和Storyboarding。 Here is the storyboard:
这是情节提要:
Here is the workflow I'd like to have: 这是我想要的工作流程:
Problem is the Edit document view does not have the navigation bar even if I try to set the property self.navigationBarHidden = NO;
问题是,即使我尝试设置属性
self.navigationBarHidden = NO;
编辑文档视图也没有导航栏self.navigationBarHidden = NO;
This seems normal to me though since I've presented the views modally but how to do it then? 虽然这对我来说似乎很正常,因为我已经以模态方式呈现了视图,但是那怎么办呢?
I tried pushing my cameraVC from the tableVC but I get an error saying that stacking 2 navigationControllers is prohibited (since cameraVC subclass of UIImagePickerController subclass of UINavigationController). 我尝试从tableVC推送我的cameraVC,但是收到一条错误消息,提示禁止堆叠2个navigationControllers(因为UINavigationController的UIImagePickerController子类的cameraVC子类)。 It seems that my only option is to present the cameraVC modally but then I don't know how to present the Edit document VC with its navigation bar.
看来,我唯一的选择是模态显示cameraVC,但随后我不知道如何使用其导航栏显示“编辑”文档VC。
EDIT : Having a navigation bar in the cameraVC is not optimal but is acceptable if this is the only way of doing it. 编辑 :cameraVC中的导航栏不是最佳选择,但如果这是唯一的方法,则可以接受。
It would appear that the best solution is to use an unwind segue! 似乎最好的解决方案是使用轻松的搜索!
In summary: 综上所述:
1)In the tableVC create a method such as 1)在tableVC中创建一个方法如
- (IBAction)unwindToThisViewController:(UIStoryboardSegue *)unwindSegue
{
NSLog(@"Rolled back");
}
2)Create an unwind segue for your previewDocumentVC and give it a unique ID such as "unwindFromPreview", connecting it to the unwindToThisViewController
IBAction. 2)为您的PreviewDocumentVC创建一个展开序列,并为其指定一个唯一的ID,例如“ unwindFromPreview”,并将其连接到
unwindToThisViewController
IBAction。 Check this answer I gave in the past for the detailed steps on how to achieve this (steps 2 and 3). 检查一下我过去给出的答案 ,以获取有关如何实现此步骤的详细步骤(步骤2和3)。
3)Create a prepareForSegue
method in your previewDocumentVC where you set some tableVC BOOL property, such as 3)在previewDocumentVC中创建一个
prepareForSegue
方法,在其中设置一些tableVC BOOL属性,例如
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"unwindFromPreview"]) {
((TableVC*)segue.destinationViewController).shouldTransitionToEditDocVC = YES;
}
}
4) In your tableVC's ViewWillAppear
method you then check the shouldTransitionToEditDocVC
and if it is set to YES you perform the segue to the editDocVC. 4)然后在tableVC的
ViewWillAppear
方法中,检查shouldTransitionToEditDocVC
,如果将其设置为YES,则对editDocVC进行选择。
I hope this helps! 我希望这有帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.