2010-01-30 78 views
1
static NSInteger shakeCount=0; 
static NSDate *shakeStart; 
static NSOrderedDecending; 

NSDate *now=[[NSDate alloc]init]; 
NSDate *checkDate=[[NSDate alloc] initWithTimeInterval:1.5f sinceDate:shakeStart]; 
if([now compare:checkDate]==NSOrderedDecending || shakeStart ==nil) 
{ 
    shakeCount=0; 
    [shakeStart release]; 
    shakeStart=[[NSDate alloc]init]; 
} 
[now release]; 
[checkDate release]; 


if(fabsf(acceleration.x) > 2.0 
    || fabsf(acceleration.y) > 2.0  
    || fabsf(acceleration.z) > 2.0) 
{ 
    shakeCount++; 
    if(shakeCount>4) 
    { 

     shakeCount=0; 
     [shakeStart release]; 
     shakeStart =[[NSDate alloc]init]; 
    } 
} 
} 

但是得到錯誤爲「NSOrderedDecending not declare」。如何申報NSOrderedDeep

回答

2

這是NSOrderedDescending而不是NSOrderedDecending。注意德SC結束對德Ç結束

+1

並刪除了'靜態NSOrderedDecending;'「說法」了。 – kennytm 2010-01-30 06:38:36