Swift比较LongPress.state之间的locationInView

时间:2015-07-06 09:15:11

标签: ios swift

我是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("          ")
    }
}

0 个答案:

没有答案