草庐IT

UINavigationcontroller

全部标签

ios - 如何跳转到另一个 UINavigationController 中的任何 ViewController

我有一个使用Storyboard创建的项目。我有很多ViewControllers,与segues相连。现在我想从ViewController(下面的VC)A获取,它嵌入在navigationController(作为RootVC)中,并由另一个VCB(也由另一个VCC模态地呈现)以模态转场呈现给任何其他VCStoryboard中的D(在本例中是主导航ControllerE中的第一个)。我经历过NavigationController层次结构被模态segue“破坏”,并且因为我需要在VCA中使用pushsegue的功能,所以我需要使用第二个NavigationController...

ios - 在 IOS 中自定义 UINavigationBar 而不使用 UINavigationController 设置背景图像不起作用

我是IOS新手。所以我尝试在不使用导航Controller的情况下自定义UINavigationBar。我可以更改图block和背景颜色,但我已尝试以编程方式设置背景图像,但它不起作用。是否可以使用Storyboard本身设置背景图像?我已经尝试过大多数以编程方式使用的网站。那么有什么方法可以使用UIStoryboard设置背景图像吗? 最佳答案 我们可以这样做你得到了的输出注意如果您从Assests加载图像,请使用UIImage(named:"xx")ifletimg=UIImage(named:"xx"){self.topBar

swift - prepareForSegue 使用 UINavigationController 切换……更好的方法?

我有几个segues呈现模态视图Controller。classProfileViewController:UIViewController{funcconfigure(profile:Profile){//SomeProfileViewControllerspecificconfig}}classSettingsViewController:UIViewController{funcconfigure(settings:Settings){//SomeSettingsViewControllerspecificconfig}}所以这里有一些我们都写过很多次的非常标准的代码......

ios - 在 Swift 中转换从 UINavigationController 中提取的 viewController

我在UINavigationController中有UIViewController。这个ViewController实现了一个协议(protocol)。我正在尝试获取导航堆栈的第一个Controller并对其进行转换:ifletvc=_navigationStack.viewControllers?[0]as?ExplorerInterface{returnvc}但我收到错误:Cannotdowncastfrom'AnyObject?'到非@objc协议(protocol)类型“ExplorerInterface”。我正在寻找一种无需将@objc关键字添加到我的协议(protocol

swift - 无法将 UIBarButtonItem 添加到 UINavigationController 中的工具栏

我尝试将UIBarButtonItem添加到UINavigationController的工具栏,但它没有显示任何按钮,并且发现_toolbar数组调试时是空的。overridefuncviewDidLoad(){vardefault_title=["A","B","C","D"]varitems:NSArray=NSArray()fortitleindefault_title{items.arrayByAddingObject(UIBarButtonItem(title:title,style:UIBarButtonItemStyle.Bordered,target:self,act

ios - 如何使用 UINavigationController 强制设置横向方向(Swift 2.0 iOS 9)

我试图找到一个解决方案,但是太多的信息都不起作用。我最后一次尝试使用以下内容:UIApplication.sharedApplication().setStatusBarOrientation(UIInterfaceOrientation.LandscapeRight,animated:false)然而,这已从iOS9中弃用,并且找不到任何方法来使用UINavigationController强制旋转。我的应用程序主要使用纵向,只有一个View需要是横向的。我需要在一个View上强制横向,然后休息以保持纵向。任何帮助将不胜感激!我检查的一些问题是:Settingdeviceorient

ios - UINavigationController 的 viewControllers 和 childViewControlle 之间的区别

fileprivatefunctest(){guardletw=self.view.windowelse{print("nowindow")return}guardletrootvc=w.rootViewControlleras?UINavigationControllerelse{print("norootvc")return}forvcinrootvc.childViewControllers{print("CHILD\(vc)")}forvcinrootvc.viewControllers{print("VC\(vc)")}}上面的代码显示相同。但是childViewContro

ios - 在 Swift 中从 AppDelegate 加载嵌入到 UINavigationController 的 Controller

我需要从AppDelegate显示一个嵌入到UINavigationController的TableView。我一般用letviewController:UIViewController=UIStoryboard(name:"Main",bundle:nil).instantiateViewControllerWithIdentifier("prova")asViewControllerwindow?.rootViewController?.presentViewController(viewController,animated:false,completion:nil)但它不适用于

ios - 无法将类型 'UITableViewController' 的值转换为 'UINavigationController'

我正在尝试从一个ViewController转到另一个ViewController,并将数据传递给下一个Controller。但我不断收到此错误:Couldnotcastvalueoftype'UITableViewController'to'UINavigationController'overridefuncprepareForSegue(segue:UIStoryboardSegue,sender:AnyObject!){if(segue.identifier=="segueLogWaterData"){//passdatatonextviewletnav=segue.desti

swift - 以编程方式创建的具有大标题的 UINavigationController 位于 UIStatusBar 下

我正在以编程方式创建一个UINavigationController:navigationController=UINavigationController(rootViewController:modeSelectVC!)navigationController?.delegate=selfwindow.rootViewController=navigationControllerwindow.makeKeyAndVisible()然后我自定义我的UINavigationBar外观,如下所示:navigationBarAppereance.barTintColor=UIColor.C