Swift:Popover解雇回调
发布时间:2020-12-14 05:49:05 所属栏目:百科 来源:网络整理
导读:我的Storyboard中有两个UIViewConrollers:MainViewController和SecondViewController.当用户点击名为Show Popover的按钮时,我将把SecondViewController显示为弹出框: //MainViewControlleroverride func prepareForSegue(segue: UIStoryboardSegue,sender:
我的Storyboard中有两个UIViewConrollers:MainViewController和SecondViewController.当用户点击名为Show Popover的按钮时,我将把SecondViewController显示为弹出框:
//MainViewController override func prepareForSegue(segue: UIStoryboardSegue,sender: AnyObject?) { if segue.identifier == "GoToSecondViewControllerSegue" { var vc = segue.destinationViewController as! SecondViewController var controller = vc.popoverPresentationController if controller != nil { controller?.delegate = self vc.inputTextDelegate = "I'm a popover!" } } } func popoverPresentationControllerDidDismissPopover(popoverPresentationController: UIPopoverPresentationController) { println("done") } func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle { return .None } //SecondViewController @IBAction func dismissPopover(sender: UIButton) { dismissViewControllerAnimated(true,completion: nil) //This dismisses the popover but does not notify the MainViewConroller } segue的锚点连接到一个按钮: 现在我有两个问题: >当我点击popover内的取消按钮时,它会解除弹出窗口但不会在MainViewController中触发popoverPresentationControllerDidDismissPopover
或者,更简单地说,当您手动关闭弹出窗口时,只需手动调用iOS的委托方法.
dismissViewControllerAnimated(true,completion: nil) popoverPresentationController?.delegate?.popoverPresentationControllerDidDismissPopover?(popoverPresentationController!) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 【A10】Nand Flash空间新增一个共享分区方法
- swift – UICollectionview scrollToItemAtIndexPath,在动画
- ruby-on-rails – Rails和attr_accessible:如果一个非质量
- VB中文文章
- oracle的分析函数over(Partition by...) 及开窗函数
- FLASH多参数的URL地址(带&符号时如何处理)
- 如何强制Flex控件显示手型光标(hand cursor)
- c# – 如何将类型“Type”的变量传递给通用参数
- MINI6410移植攻略
- 正则表达式总结(\nml,\nm,\un,\xn/i等等