与@patchdiaz相同,我不是100%确定你想要做什么。然而,这个代码块可能足以进行定制,以实现自己的目标:
override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]? {
let edit = UITableViewRowAction(style: .Normal, title: "Edit") { action, index in
// OPEN UIPresentationController HERE
let vc = UIViewController(nibName: nil, bundle: nil)
vc.view.frame = CGRect(x: 0, y: 0, width: 100, height: 200)
vc.view.backgroundColor = UIColor.orangeColor()
vc.modalPresentationStyle = .Popover
let popover = vc.popoverPresentationController!
let cell = tableView.cellForRowAtIndexPath(indexPath)!
var cellAbsolutePosition = cell.superview!.convertPoint(cell.frame.origin, toView: nil)
cellAbsolutePosition.x = cell.frame.width - 60
popover.sourceRect = CGRect(origin: cellAbsolutePosition, size: cell.frame.size)
popover.sourceView = tableView
self.presentViewController(vc, animated: true, completion: nil)
}
return [edit]
}
它会显示一个酥料饼就在这样的“编辑”按钮位置:
我说这只是一个例子,如何做到这一点,足够的定制:)请做其余的,因为我相信你知道如何使它 – Ducky
我不能修复附近的箭头编辑,我不知道如何设置高度对于我用作故事板的vc –
老兄,这是完全不同的问题。如果您希望人们更高效地帮助您,请提供更多详细信息。 – Ducky