1
以下代碼適用於4.2 & 4.3但在4.0 & 4.1值爲NaN,但僅在UIGestureRecognizerStateEnded案例中出現。它顯示了UIGestureRecognizerStateChanged手勢識別器僅在iPhone 4.0和4.1中出現問題
- (void)panGesture:(UIPanGestureRecognizer*)gestureRecognizer
{
CGPoint touchPoint = [gestureRecognizer locationInView:self];
switch ([gestureRecognizer state]) {
case UIGestureRecognizerStateChanged:
NSLog(@"panChanged - touchPoint = %f", touchPoint.x); // Always works
case UIGestureRecognizerStateEnded:
NSLog(@"panEnded - touchPoint = %f", touchPoint.x); // Always outputs nan
}
不知道這是蘋果的部分錯誤,或者如果我做錯了正確的值。請告知
您的交換機中沒有中斷聲明。那是故意的嗎? – Vagrant 2011-03-29 20:24:34
是的,我拿出一些代碼只是爲了演示的目的。我原來的代碼的確有斷言。儘管趕上:) – 2011-04-01 16:50:24