【发布时间】:2018-04-05 12:46:33
【问题描述】:
我很困惑如何在提供的屏幕截图上定位弹出窗口以指向点击的单词。文本视图中的单词是灰色的。我会展示一些代码,但除了处理水龙头的代码之外,我没有其他相关的代码。
这是一些代码:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
if(segue.identifier == "popOverSegue") {
let destinationViewController: PopoverViewController = segue.destination as! PopoverViewController
destinationViewController.modalPresentationStyle = UIModalPresentationStyle.popover
destinationViewController.popoverPresentationController!.delegate = self
destinationViewController.popoverPresentationController?.permittedArrowDirections = .down
destinationViewController.tappedWord = tappedWord
destinationViewController.definitionText = "This is a test description"
let x = meaningText.frame.minX
let y = meaningText.frame.minY
destinationViewController.popupOrigin = CGPoint(x: x + pointOfTap.x,y: y + pointOfTap.y)
destinationViewController.popupSize = CGSize(width: 200, height: 200)
debugPrint(meaningText)
}
}
【问题讨论】: