jjzjj

PrepareForSegue

全部标签

ios - 以编程方式调用 push segue 和 prepareforsegue 方法

我正在以编程方式调用pushsegue,如下所示UIStoryboard*mainStoryBoard=[UIStoryboardstoryboardWithName:@"Main"bundle:nil];UIViewController*vc=[mainStoryBoardinstantiateViewControllerWithIdentifier:@"addToCartViewContollerForItem"];[self.navigationControllerpushViewController:vcanimated:YES];但我的问题是我想用这个segue将一些信息发送

ios - 如何在 prepareForSegue 之前调用 didSelectRowAtIndexPath?

我正在制作基于tableview的iOS应用程序。这就是我想要做的。TableView1->TableView2一旦我选择了tableCell之一,就会显示新的tableView2。我想在显示新的tableView之前突出显示单元格。尽管如此,由于加载了新的tableView数据,hilight还是很慢。我查了一下这个。之所以在didSelectRowAtIndexPath之前调用了prepareForSegue。那你能告诉我如何在prepareForSegue之前调用didSelectRowAtIndexPath吗?或者告诉我如何在选中单元格时设置表格单元格。祝一切顺利

ios - prepareForSegue() 不工作( swift )

希望得到一些帮助来确定为什么我的prepareForSegue()不工作。这是我的Main.storyboard和segue的标识符。http://i.stack.imgur.com/GFsqF.png我将Prototype单元格作为选择segue(显示)链接到UITabBarController,它将有一些UIViewController连接到它。我在prepareForSegue中放置了断点,发现它从未进入函数,我怀疑我可能错误地设置了segue,但我在iOS开发方面的经验不足导致我忽略了问题所在。这是我在MainViewController上的prepareForSegue()上

ios - Swift - 在 prepareForSegue 方法中使用 Switch 语句

我设置了以下switch语句,以处理3种不同的按钮点击:石头、布、剪刀。例如,点击Rock按钮,您将转到ResultViewController,并显示“rockSegue”信息。每次我运行应用程序,然后点击其中一个按钮(例如摇滚)时,它会在转换到ResultViewController时崩溃,说在展开可选值时resultImage包含nil。它引用的Assets肯定存在,所以我对我在这里做错了什么有点困惑?overridefuncprepareForSegue(segue:UIStoryboardSegue,sender:AnyObject?){letcontroller=segue

ios - prepareForSegue Swift 时发现 nil

我完全不确定为什么会这样。当我尝试使用prefpareForSegue时,我得到“在展开可选值时意外发现nil”。我知道这意味着什么以及它发生在哪里,但我不知道为什么。我的代码中标记的任何一行都发生了错误。我已经测试了值dateText和currentDate并且都不是nil。overridefuncprepareForSegue(segue:UIStoryboardSegue,sender:AnyObject?){varDestViewController:CreatePostScrollViewController=segue.destinationViewControlleras

ios - prepareForSegue UICollectionView 不工作( swift )

我尝试使用UICollectionView(将图像从MasterView显示到DeatilView)来推送segue,但没有用。Xcode也没有显示任何错误信息。我的代码有什么问题。我需要一些建议。overridefuncprepareForSegue(segue:UIStoryboardSegue,sender:AnyObject?){ifsegue.identifier=="showDetail"{ifletindexPath=self.collectionView?.indexPathForCell(senderas!UICollectionViewCell){letdetail

swift - 使用 prepareForSegue 传递数据不起作用

我正在使用MapKit,当您单击注释气球时,您会被定向到另一个View。我为此使用的功能是:funcmapView(mapView:MKMapView!,annotationView:MKAnnotationView,calloutAccessoryControlTappedcontrol:UIControl){//gettaghereif(annotationView.tag==0){//Dofor0pin}ifcontrol==annotationView.rightCalloutAccessoryView{performSegueWithIdentifier("mapToCity

ios - PrepareforSegue 函数从不运行,附加 View Controller 中的变量为空

我正在尝试将一些变量发送到另一个ViewController,并且我正在以编程方式触发segue。出于某种原因,这些变量永远不会被传递,打印语句也永远不会运行。当我尝试从我的下一个ViewController中检索变量时,变量只是nil且未分配。我有以下实际触发segue的函数,在我的ViewController的底部有prepareforsegue:funcaction(gestureRecognizer:UILongPressGestureRecognizer){if(lpgr!.state==UIGestureRecognizerState.Began){print("Began

ios - prepareForSegue 什么时候被调用?

这是我的情况,我有两个ViewController:viewControllerA和tableViewControllerB。在我的viewControllerA上,我有一个按钮。当它被按下时,它会调用self.performSegueWithIdentifier("toControllerB",sender:self)此外,我编写了一个prepareforSegue函数,如下所示:overridefuncprepareForSegue(segue:UIStoryboardSegue,sender:AnyObject?){if(segue.identifier=="toControll

ios - UIView 在 prepareForSegue 方法中为 nil

抱歉让标题混淆了,我不知道如何让它更有意义。我正在使用这个例子实现信息窗口:github我在popView中添加了几个标签并将它们链接到secondaryVieController。我已将PrimaryViewController中的prepareForSegue方法修改为:overridefuncprepareForSegue(segue:UIStoryboardSegue,sender:AnyObject?){ifsegue.identifier=="showInfo"{letinfo=segue.destinationViewControlleras!SecondaryViewC