展示一个新的视图控制器保持标签栏 [英] Presenting a new View Controller Keeping Tab Bar

查看:17
本文介绍了展示一个新的视图控制器保持标签栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发支持 iOS6+ 的 iPhone 应用程序.应用程序的结构有一个 UITabBarController 作为根控制器,并为其分配了许多视图控制器.On one of the tabs is a UITableViewController with a list of items that, when selected, displays a detail view of that item using a push seque.

I'm currently developing an iPhone App supporting iOS6+. The structure of the application has a UITabBarController as the root controller with a number of view controllers assigned to that. On one of the tabs is a UITableViewController with a list of items that, when selected, displays a detail view of that item using a push seque.

但是,我还有另一个允许 QR 扫描的屏幕.当二维码被扫描时,结果被处理以检索一个 id,然后我想显示匹配项目的详细信息视图页面(如上).

However, I also have another screen that allows QR scanning. When the QR code is scanned, the result is processed to retrieve an id that I then want to display the detail view page for the matching item (as above).

我可以在 QR 扫描视图控制器中使用以下代码来显示它,但此时会丢失标签栏和导航的任何希望.

I can get this to display using the following code in the QR scanning view controller, but this loses the tab bar and any hope of navigation at this point.

[self presentViewController:detailController animated:YES completion:nil];

有什么方法可以显示详细信息视图控制器,但仍然保留通过 UITableView 路由时获得的选项卡栏(最好是导航栏)?到目前为止,我发现的所有内容都引用了 presentModalViewController,但从 iOS6 开始,它似乎已被弃用并替换为 presentViewController.

Is there any way that I can present the detail view controller, but still keep the tab bar (and ideally the navigation bar) that I'd get when going through the UITableView route? Everything that I've found so far references presentModalViewController but that seems to have been deprecated as of iOS6 and replaced with presentViewController.

预先感谢您的任何帮助或建议,

Thanks in advance for any help or suggestions,

菲尔哈尔夫

推荐答案

模态视图将覆盖所有视图,最终取代 tabBarController、NavigationCONtroller 等...

The modal view will come over all view replacing eventually a tabBarController, NavigationCOntroller etc...

Modal view :
Can works for all view controllers
Is over all other view and need to be pop programatically (adding a button back manually for example)

Push View :
Only works in navigation controllers
Add automatically a back button in the navigationController

我相信你想要的是一个 pushView,它将被集成到你的 navigationController 中:

I believe that what you want is a pushView which will be integrate in your navigationController :

[self.navigationController pushViewController:viewController animated:YES];

这篇关于展示一个新的视图控制器保持标签栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆