【发布时间】:2016-06-02 10:15:16
【问题描述】:
我的场景是这样的。 我有一个带有按钮的表格视图单元格。如果触发它,菜单将弹出如下所示
对于上面的菜单弹出窗口,源是出现在每个单元格最右边的按钮。
我有另一个名为 diplayAccounts 的表视图。 单击弹出菜单的单元格(即视图层次结构)时,displayAccounts 视图控制器需要显示为弹出框。我怀疑它的来源应该是什么。
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
menuTapped(self)
}
方法menuTapped如下
func menuButtonTapped(sender: AnyObject)
{
let storyboard : UIStoryboard = UIStoryboard(name: "Storyboard", bundle: nil)
let vc = storyboard.instantiateViewControllerWithIdentifier("HierarchyTableViewController") as! HierarchyTableViewController
vc.modalPresentationStyle = UIModalPresentationStyle.Popover
let popover: UIPopoverPresentationController = vc.popoverPresentationController!
popover.sourceView = sender as? UIView
popover.delegate = self
presentViewController(vc, animated: true, completion:nil)
}
我遇到的错误
【问题讨论】:
-
"现在我想在点击 viewHierarchy 时获得另一个弹出窗口" 你这是什么意思?
-
我有另一个名为 diplayAccounts 的表视图。单击弹出菜单的单元格(即视图层次结构)时,需要将 displayAccounts 视图控制器显示为弹出框。我怀疑它的来源应该是什么。