是否可以将手势从当前视图控制器传递到弹出视图控制器

时间:2017-07-10 06:22:32

标签: ios swift modalviewcontroller

在我提交的ViewController中,我有一个按钮,长按此处我会ViewController modalPresentationStyle popover。问题是我想将相同的触摸手势传递给弹出窗口,这样我就不必再做一个触摸事件来使事情有效。在我目前的情况下是否有可能或你建议解决?

interactionViewController?.delegate = self
interactionViewController?.indexpathRow = indexPathRow

interactionViewController?.modalPresentationStyle = .popover
interactionViewController?.popoverPresentationController?.backgroundColor = .clear
interactionViewController?.preferredContentSize = CGSize(width: 320, height: 220)
interactionViewController?.view.layer.cornerRadius = 25

let popoverMenuViewController = interactionViewController?.popoverPresentationController
popoverMenuViewController?.permittedArrowDirections = UIPopoverArrowDirection.init(rawValue: 0)
popoverMenuViewController?.sourceView = sender as? UIView
popoverMenuViewController?.popoverBackgroundViewClass = PopupControllerBackgroundView.self
popoverMenuViewController?.sourceRect = CGRect(x: 0,y:0,width: 1,height: 1)
popoverMenuViewController?.delegate = self

self.present(self.interactionViewController!, animated: false, completion: { [weak self] in

    self?.interactionViewController?.view.superview?.layer.cornerRadius = 40
    self?.interactionViewController?.view.superview?.backgroundColor = .clear
})

0 个答案:

没有答案