草庐IT

MX_Controller

全部标签

ios - 如何在多个容器 View 中快速重用相同的 View Controller ?

我在ViewController(比如说A)中有一个容器View,其中嵌入了一个到同一Storyboard中的ViewController(比如说B)的转场。现在的要求是我必须在不同Storyboard中的ViewControllerC的另一个容器View中使用相同的嵌入式ViewControllerB。是否可以在多个容器View中重用ViewControllerB? 最佳答案 1)为ViewControllerB添加Storyboard标识符2)在ViewControllerC中添加一个容器View3)删除嵌入到ViewContr

ios - 导航 Controller :willShowViewController:animated: is not called after popToRootViewControllerAnimated in presented view controller

我有UINavigationController和几个推送的ViewController。UPD:最后按下的Controller模态呈现另一个Controller。另外,我在navigationController:willShowViewController:animated:中有一些逻辑UINavigationControllerDelegate。UPD:导航Controller是它自己的委托(delegate)。委托(delegate)在viewDidLoad方法中设置。问题当我尝试从呈现的ViewController中以编程方式关闭所有Controller时出现://Close

swift - 使用 Storyboard 和自定义 View Controller init

当以编程方式推送ViewController时,可以通过init方法轻松地进行一些依赖注入(inject):letdummyVC=DummyVC(dummyManager:DummyManager())self.pushViewController(dummyVC,animated:true)使用目标Controller:classDummyVC:UIViewController{privateletdummyManager:DummyManagerinit(dummyManager:DummyManager){self.dummyManager=dummyManagersuper.i

ios - 从 Controller 外部在 collectionView 上快速重新加载数据

我有一个带有collectionView的Controller,它可以从API中提取项目数据。数据存储在struct->static变量中。我需要从应用中的多个区域访问这些数据。当API数据进来时,如何重新加载tableView数据?ControllerclassCollectionsViewController:UIViewController{}extensionCollectionsViewController:UICollectionViewDataSource{funccollectionView(_collectionView:UICollectionView,number

ios - 如何在推送其 View Controller 之前预加载 WKWebView?

我问这个问题是因为经过一些研究,我没有在网上找到满意的答案。我的需求很简单,我有一个UITableViewController,当我点击一个单元格时,我需要显示一个加载程序(同时加载WKWebViewContent),然后推送下一个UIViewController,其中已经加载了WKWebView。我试过这个:classTableViewController:UITableViewController,WKNavigationDelegate{varwebviewToLoad:WKWebView!overridefunctableView(_tableView:UITableView,

swift - 如何在 App Delegate 中使 Controller 独立?

所以在AppDelegate.swift文件中,我有一个UINavigationController作为RootViewController,一个mainController作为navigationController的topViewController。我在这里实例化了所有数据,因此它可以是独立的。现在,我想将MenuController作为我的topViewController,但我不确定如何从这里调用mainController。更具体地说,我正在创建一个填字游戏,并且一直专注于网格等的逻辑和实现。现在我想在显示填字游戏之前制作一个菜单作为我的第一个屏幕。主菜单->菜单Contr

ios - UINavigationController inside UITabBarController inside UISplitViewController(仍然)以模态方式显示细节 Controller 而不是推送

在我的通用应用程序中,我有一个似乎非常常见的设置,具有根UISplitViewController,使用UITabBarController作为masterViewController,然后我想:如果我使用的是垂直iPhone,则将详细ViewController插入堆栈在横向iPhone6+和其他更大的屏幕(如iPad等)上的UISplitViewController的detailViewController中显示细节Controller为此,我的设置与所有提到类似问题的讨论中描述的设置完全相同:UINavigationControllerinsideaUITabBarControl

ios - 在 Swift 中遍历 View Controller 层次结构

我想遍历Swift中的ViewController层次结构并找到一个特定的类。这是代码:extensionUIViewController{functraverseAndFindClass()->UIViewController?{varparentController=self.parentViewControlleras?T?^||//Error:Couldnotfindauser-definedconversionfromtype'UIViewController?'totype'UIViewController'while(parentController!=nil){pare

swift - 如何快速将 didSelectRowAtIndexPath 发送回 View Controller

我在swift中有1个viewController和1个tableViewController。我可以从viewController发送一个NSMutableArray来使用segue填充tableViewController。我不知道如何将选定的行发送回ViewController。到目前为止的代码:overridefunctableView(tableView:UITableView,didSelectRowAtIndexPathindexPath:NSIndexPath){println("Youselectedcell#\(indexPath.row)!")//Missingc

ios - 从 AppDelegate.swift 给 View Controller 赋值

我尝试从AppDelegate.swift为ViewController分配一个值,但没有成功。我的Controller名为DestinationsViewController,它在Main.storyboard中的id是destinationsID。DestinationsController嵌入在导航Controller中。我要更改的对象名为“标签”。这是代码:ifletdestinationsViewController=storyBoard.instantiateViewControllerWithIdentifier("destinationsID")as?Destinati