swift/iOS 9 : using Popover Presentation with a UITableViewCell

标签 swift ios9 popover uipopover

我不断收到此错误,因为我无法正确锚定我的 segue。我尝试过混合使用 Storyboard和编码。

enter image description here enter image description here

我是 iOS 的新手,所以我一直试图通过查看 this solution 来解决这个问题,但没有成功。 ,以及 Youtube 视频。任何帮助将不胜感激!

最佳答案

根据我的经验,以编程方式执行此操作并完全忘记 segue/ Storyboard会更容易。

这适用于 swift 2.0

func showPopOverBox(button:UIButton) {
    let popoverViewController = self.storyboard?.instantiateViewControllerWithIdentifier("yourviewcontrollerstoryboardId") as UIViewController!
    popoverViewController.modalPresentationStyle = .Popover
    popoverViewController.preferredContentSize   = CGSizeMake(600, 600)

    let popoverPresentationViewController = popoverViewController.popoverPresentationController

    popoverPresentationViewController?.permittedArrowDirections = UIPopoverArrowDirection.Any
    popoverPresentationViewController?.sourceView = button
    popoverPresentationViewController?.sourceRect = button.bounds

    presentViewController(popoverViewController, animated: true, completion: nil)

}

关于 swift/iOS 9 : using Popover Presentation with a UITableViewCell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33454770/

相关文章:

swift - 如何在 Swift 中的弹出窗口及其箭头上添加边框颜色?

javascript - 获取隐藏的输入值并在弹出窗口中查看 JavaScript

ios - iOS8 模式弹出窗口中 UINavigationController View 的宽度?

swift - 如何使用firebase在ios中实现私聊

swift - 确定何时随机调用函数的最佳方法

java - Java 中是否有类似于 Swift 的强引用循环(或类似的东西)的概念?

ios - iOS 9 的 NSURLSession/NSURLConnection HTTP 加载失败和其他 AdMob 警告

iOS9 应用传输安全 : Allow insecure HTTP loads only on certain subpages

ios - 无法保存 NETunnelProviderManager 的配置

ios - Swift 表格 View 单元格选择更改复选框图像