English 中文(简体)
• 如何防止多时 iPhone?
原标题:How Prevent multiple times iPhone shaking?
  • 时间:2010-08-10 11:03:14
  •  标签:
  • iphone

i 采用这一方法处理我的 app,但我有巨大的问题促使我cra!

i use this method : http://www.iphonedevsdk.com/forum/iphone-sdk-development/55087-iphone-shake-detection-problem.html#post230283

但是,问题正被多次察觉到震 event事件!

2010-08-10 14:06:43.700 APP[406:207] SHAKED
2010-08-10 14:06:44.340 APP[406:207] SHAKED
2010-08-10 14:06:44.692 APP[406:207] SHAKED
2010-08-10 14:06:44.868 APP[406:207] SHAKED
2010-08-10 14:06:45.044 APP[406:207] SHAKED
2010-08-10 14:06:45.172 APP[406:207] SHAKED
2010-08-10 14:06:45.332 APP[406:207] SHAKED
2010-08-10 14:06:45.492 APP[406:207] SHAKED
2010-08-10 14:06:45.644 APP[406:207] SHAKED

如何处理。

最佳回答

你们必须放弃所掌握的数据。 这一原则非常简单,一读“。 仅仅无视今后二者的所有价值观。

你可能希望考虑使敏感度(延误)可以预测。

例:

NSDate *start = [NSDate date];

-(void)method:(UIAccelerometer *)accelerometer {
    NSTimeInterval timeInterval = [start timeIntervalSinceNow];
    /* if our last shake was more than 1 second ago */
    if(timeInterval > 1.0){
        /* do yourthing here */
        start = [NSDate date];
    }
}
问题回答

也许问题在于,你发现加速度仪数据的每一小变化。 我使用以下代码探测平均扫描:

- (void) accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration 
{
    if(sqrt(acceleration.x*acceleration.x + acceleration.y*acceleration.y + acceleration.z*acceleration.z)>3.0)
    {
        [self DoSomething];
    }
}

你们可以改变3.0%的数值,以发现更强/更小的螺 。





相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签