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)
}
网友评论