swift怎么获取touch里的点
2016-01-02 本文已影响0人
Ywaiting
override func touchesBegan(touches:Set, withEvent event: UIEvent?) {
if let brush = self.brush {
brush.lastPoint = nil
//之前一直是用这个方法来获取的
//brush.beginPoint = touches.anyObject()!.locationInView(self)
//现在上面那个touches里面没有anyObject()这个方法,所以我们需要做类型转换
brush.beginPoint = (touches as NSSet).anyObject()!.locationInView(self)
}