2
我需要在IOS發揮振動小於0.25的第二和玩一個振動爲小於0.25的第二振動的序列就會像是有可能在IOS在objc
1振動0.25秒然後3振動0.15秒,並且該循環將持續有限的時間,例如2或3分鐘。同時這裏需要的精度是指每個振動必須
現在在準確的時間開始時,我玩振動發揮它每秒
-(IBAction)onBtnVibrateClicked:(id)sender {
[self.view endEditing:YES];
[myTimer invalidate];
if(_txt_VibrationPerMinute.text.length == 0){
_txt_VibrationPerMinute.text = @"10";
}
myTimer = [NSTimer scheduledTimerWithTimeInterval:60/[_txt_VibrationPerMinute.text intValue]
target:self
selector:@selector(targetMethod:)
userInfo:nil
repeats:YES];
}
- (IBAction)obBtnStopVibrationClicked:(id)sender {
[myTimer invalidate];
}
-(void)targetMethod:(NSTimer *)timer {
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
}
根據[this](http://www.kimballlarsen.com/2009/12/22/how-to-make-iphone-vibrate-for-a-long-time/),'AudioServicesPlaySystemSound(kSystemSoundID_Vibrate )'產生0.4秒的振動,所以我認爲在短時間內產生振動是不可能的 – spassas