0
저는 몇 시간 동안이 문제로 고심하고 있습니다. UITapGestureRecognizer를 사용하는 절차를 이해할 수없는 것 같습니다. 어떤 도움을 주시면 감사하겠습니다.UITapGestureRecognizer 오류
@IBOutlet weak var textView: UITextView!
override func viewDidLoad() {
let textInView = "This is my text."
textView.text = textInView
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(tapResponse(_:)))
tapGesture.numberOfTapsRequired = 1
textView.addGestureRecognizer(tapGesture)
func tapResponse(sender: UITapGestureRecognizer) {
var location: CGPoint = sender.location(in: textView)
location.x = textView.textContainerInset.left
location.y = textView.textContainerInset.top
print(location.x)
print(location.y)
}
}
감사합니다! 그것은 저를 오랫동안 괴롭 혔습니다. –