LIH*_*LIH 3 delegates ios swift
我是iOS和swift的新手.我正试图展示一个弹出窗口.我设法显示一个弹出窗口,但问题是我需要从父母那里解雇它.
我可以使用此代码从ViewController本身中删除popover
self.dismissViewControllerAnimated(true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
但我需要从父视图控制器执行此操作.
到目前为止我已经这样做了.在按钮上单击performSegueWithIdentifier("bookingPopOverSegue",sender:self)
在prepareForSegue上,
if segue.identifier == "bookingPopOverSegue" {
var bookingViewController = segue.destinationViewController as! BookingViewController
var passthroughViews: [AnyObject] = self.timeSlotButtons
passthroughViews.append(self.scrollView)
bookingViewController.popoverPresentationController?.passthroughViews = passthroughViews
}
Run Code Online (Sandbox Code Playgroud)
有关如何做到这一点的任何想法?任何帮助,将不胜感激..
Nir*_*iya 17
只需使用parent的presentViewController属性调用dismiss方法,就像....
self.presentedViewController.dismissViewControllerAnimated(true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
对于Swift 3.0
self.presentedViewController?.dismiss(animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10674 次 |
| 最近记录: |