【问题标题】:Popover segue from UICollectionView ReusableView (header)来自 UICollectionView ReusableView (header) 的 Popover segue
【发布时间】:2015-08-27 22:13:50
【问题描述】:

我在UICollectionView 标头中添加了UIButton。我喜欢煽动从按钮到UITableViewController 的弹出框。

  • 我从集合视图标题上的按钮控制拖动到 tableView Controller 并选择 present as popover segue。
  • 我在构建项目时收到以下错误:

Main.storyboard:

error: Couldn't compile connection: <IBCocoaTouchOutletConnection:
   0x7fd0436bc660  source=<IBProxyObject: l2l-iC-wi9 'Placeholder for
   UIStoryboardPopoverPresentationSegueTemplate with OID iIR-Qd-1S2'>
   property=anchorView  destination=<IBUIButton: xWf-K4-adt 'Anchor
   View'>>

备注

  • 如果我选择启动其他类型的 segue,它们都可以正常工作。

  • 如果按钮不在 UIcollectionView 的标题中(例如,UIViewController,UIView),则弹出框也可以正常工作。

【问题讨论】:

  • 我是 iOS 编程新手。非常感谢您的帮助。也非常感谢为我提供示例。
  • 这个问题已经 3.5 年了,没有答案,我也遇到了同样的事情。这也是Couldn't compile connection UIStoryboardPopoverPresentationSegueTemplate的唯一搜索结果。

标签: swift uibutton segue popover uicollectionreusableview


【解决方案1】:

我也遇到过这个。标题(或单元格)只是真实的代理,因为可能有多个。在情节提要中,只需从主 collectionView 本身锚定,然后您可以在 prepareforSegue 期间更改锚点以指向正确的单元格。

在单元格的按钮操作中,调用

[self peformSegue: @"SegueName" sender: cell]

然后在prepareForSegue,打电话

segue.destinationViewController.popoverPresentationController.sourceView  =  (UIView *) sender
segue.destinationViewController.popoverPresentationController.sourceRect  = ((UIView *) sender.bounds`

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-08-21
    • 1970-01-01
    • 2014-12-08
    • 2012-02-15
    • 1970-01-01
    • 1970-01-01
    • 2014-03-06
    • 1970-01-01
    相关资源
    最近更新 更多