jjzjj

SecondViewController

全部标签

iphone - 什么时候在模态视图 Controller 上设置父/呈现 View Controller ?

我正在展示一个模态视图Controller。在模态视图Controller的viewDidLoad中,我似乎找不到任何对父VC的引用....parentViewController、presentingViewController等.如果尚未设置,我应该如何获得对它的引用? 最佳答案 对于一般解决方案,您可以在第二个Controller中拥有自己的属性,它是指向第一个ViewController的weak指针。第一个Controller应该在第一个segue的prepareForSegue中设置第二个Controller的属性。在回

ios - 以编程方式快速切换另一个导航

我忽略Storyboard并在AppDelegate.swift中创建UINavigationControllerfuncapplication(_application:UIApplication,didFinishLaunchingWithOptionslaunchOptions:[UIApplication.LaunchOptionsKey:Any]?)->Bool{//Overridepointforcustomizationafterapplicationlaunch.window=UIWindow(frame:UIScreen.main.bounds)window?.mak

ios - 奇怪的大标题导航 Controller 问题

问题Iamhavingthisproblem.只有当我不在表格View的顶部时才会发生。当我在顶部时,一点问题都没有。•我也在真实设备上尝试过,但没有成功。•我认为单元格后面的阴影可能会导致它,但删除它也不起作用。•没有大标题也能正常工作,但我也想实现大标题功能。我没有以编程方式显示secondViewController。但是要返回到firstViewController,我使用以下代码:navigationController?.popViewController(animated:true) 最佳答案 找到问题了!在secon

ios - UISplitViewController 作为自定义选项卡栏 Controller 的子项

我一直在关注thistutorial为iPad应用程序创建自定义标签栏Controller,因为我想实现垂直标签栏。但是,我希望其中一个选项卡显示UISplitViewController,而其他选项卡只显示UIViewControllers。我的问题是:1)这会被应用商店接受吗?Apple的文档当前声明不建议将UISplitViews添加为subview,但可以使用某些容器来实现。有没有人有这方面的经验?2)这是我的自定义标签栏Controller的摘录。如果secondViewController正在呈现UISplitView,我可以保持原样吗?我的意思是,当我运行它时它似乎可以正

ios - 使 UIModalTransitionStyle 看起来像快速推送

我想知道是否有任何方法可以使UIModalTransitionStyle具有“推送”样式?因为我有这样的东西:letstoryBoard:UIStoryboard=UIStoryboard(name:"Main",bundle:nil)letsecondViewController=storyBoard.instantiateViewControllerWithIdentifier("SecondViewController")as!SecondViewControllersecondViewController.modalTransitionStyle=UIModalTransiti

ios - Swift - 委托(delegate)不从其他类调用方法

我试图在按下按钮时更改另一个ViewController中的标签文本。以下是我设置委托(delegate)的方式:在importUIKit下的FirstViewController中@objcprotocolMyDelegate{optionalfuncmakeScore()}在classFirstViewController:UIViewController下的FirstViewController中vardelegate:MyDelegate?在按下按钮时在FirstViewController中delegate?.makeScore!()在SecondViewController

ios - 在 Cell 外获取 CollectionViewCell 的 IndexPath

首先,我是swift的新手,所以要温柔。我在获取单元格外部单元格的indexPath时遇到问题。我想获取函数的索引路径并使用它将内容发送到另一个View。该图像是在单元格中以编程方式创建的,它有一个点击手势识别器发送到此函数(其中“myIndex”定义为Int:varmyIndex=0)://tapimagetogoattheindexpathoftheuserfuncimageTapped(tapGestureRecognizer:UITapGestureRecognizer){print("imagetapped")letstoryboard=UIStoryboard(name:"

ios - 快速在 View 之间传递数据

我正在尝试熟悉Swift,但我找不到如何使用Swift在View之间传递数据。classViewController:UIViewController{@IBOutletvarfield:UITextField@IBOutletvarbutt:UIButtonoverridefuncprepareForSegue(segue:UIStoryboardSegue!,sender:AnyObject!){ifletvc=segue.destinationViewControlleras?secondViewController{if(vc.lab!=nil){vc.lab.text=sel

ios - 在预设演示之前丢失对 transitioningDelegate 的引用

在Xcodebeta2和iOS10beta2之前,我有一个可用的自定义UIPresentationController。我没有更改任何代码,但演示文稿现在以标准模式演示文稿呈现。在UIPresentationController的Apple示例代码中有一条说明:Forpresentationswhichwilluseacustompresentationcontroller,itispossibleforthatpresentationcontrollertoalsobethetransitioningDelegate.Thisavoidsintroducinganotherobjec

objective-c - 使用委托(delegate)将数据传递回导航堆栈

几天来,我一直在为在两个ViewController之间传递数据而苦苦挣扎,并且感到非常困惑。我是Objective-C的新手,发现有些部分很难让我头脑清醒。我有一个导航Controller,FirstView是一个表单,在这个表单上我有一个按钮加载SecondView,其中包含一个TableView供用户选择一些选项。然后我想将选择传递回FirstViewController并显示数据等...我已经阅读了很多相关内容(stackoverflow、iphonedevsdk、CS193P资源),我看到的选项是,1)appdelegate中的ivar(不推荐)2)创建单例3)创建数据模型类