我是Swift的新手,我对IOS手势很感兴趣。当我尝试比较longPress.state中locationInView的值时遇到了问题。请帮帮忙。
func longPressed(longPress: UILongPressGestureRecognizer) {
var iposition: CGPoint?
var position: CGPoint?
var startx,starty,endx,endy: CGFloat?
if (longPress.state == UIGestureRecognizerState.Began) {
iposition = longPress.locationInView(self.view)
//println(iposition.y)
// println(iposition!.y)
goodtext.text = "bad"
}else if (longPress.state == UIGestureRecognizerState.Ended) {
position = longPress.locationInView(self.view)
goodtext.text = "Good"
}
if (position != nil) && (iposition != nil){
println(position)
println(iposition)
println(" ")
}
}