ios - 呈现一个新的 View Controller 保持标签栏

标签 ios iphone uiviewcontroller uitabbarcontroller

我目前正在开发支持 iOS6+ 的 iPhone 应用程序。 应用程序的结构有一个 UITabBarController 作为根 Controller ,并为其分配了多个 View Controller 。 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.

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

我可以在 QR 扫描 View Controller 中使用以下代码来显示它,但这会失去标签栏和此时导航的任何希望。

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

有什么方法可以呈现详细 View Controller ,但仍保留通过 UITableView 路由时获得的选项卡栏(最好是导航栏)? 到目前为止,我发现的所有内容都引用了 presentModalViewController,但从 iOS6 开始,它似乎已被弃用,取而代之的是 presentViewController。

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

半边天

最佳答案

模态视图将覆盖所有 View ,最终替换 tabBarController、NavigationCOntroller 等...

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 中:

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

关于ios - 呈现一个新的 View Controller 保持标签栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20264010/

相关文章:

ios - 更改细节过渡动画 UISplitViewController

iphone - 用户界面在加载时卡住并且应用程序经常崩溃

iphone - popToRootViewController 崩溃

swift - 使 UIViewController 符合 AVCapturePhotoCaptureDelegate 不起作用

swift - IBDesignable View - 在设计时需要 ViewController

ios - 我想将 Apple Pay 集成到我的应用程序中。 Apple 是否负责收款方面的事宜?

ios - SpriteKit Swift 4 错误 : Type 'Int' has no member 'random'

ios - 如何从 UITableView 中获取选定的行?

iphone - iOS 6 中带有 Storyboard 的模态视图 Controller

iphone - 如何获取有关 iPhone 中播放的音乐轨道的信息?