27
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[swift-iOS]タップした座標の取得(備忘録)

Last updated at Posted at 2016-01-11

どうってことでもないですが、大事なことなので忘れないよう、書き留めときます

ViewController.swift

class ViewController: UIViewController {
var tapLocation: CGPoint = CGPoint()

override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
// タッチイベントを取得する
let touch = touches.first
// タップした座標を取得する
tapLocation = touch!.locationInView(self.view)
}

}
27
19
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
27
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?