Swift -- 获取点击的坐标位置

2018-05-17  本文已影响13人  会飞的大西瓜v
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        //获取点击的坐标位置
        for touch:AnyObject in touches {
            let t:UITouch = touch as! UITouch
            print(t.location(in: self.contentView))
        }
    }
上一篇 下一篇

猜你喜欢

热点阅读