OGeek|极客世界-中国程序员成长平台

标题: ios - ios中的平滑触摸 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 10:56
标题: ios - ios中的平滑触摸

当我过去按下按钮时,是否有任何代码可以使我的应用程序平滑振动。目前我正在使用以下方法。请看一下

-(IBAction)buttonClickedUIButton *)sender
{
     //AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
  AudioServicesPlayAlertSound (1105);
  self.view.userInteractionEnabled = NO;

   [[HelperClass shared]playSound"single_click_12"];
[HelperClass showBounceAnimatedButton:sender completionBlock:^{
    self.view.userInteractionEnabled = YES;
    selectedIndex =(int) sender.tag;
    [self performSelectorselector(pushTheViewToGame) withObject:nil afterDelay:0.6];
}];

 // NSLog(@"Sender Tag :%li",(long)sender.tag);
}



Best Answer-推荐答案


即使启用,设备也不会振动。

1) AudioServicesPlayAlertSound(kSystemSoundID_Vibrate); 2) AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

我的方法是在测量设备运动的特定时间调用的。我不得不停止录制,然后在振动发生后重新开始。

看起来像这样。

-(void)vibrate {
    [recorder stop];
    AudioServicesPlaySystemSound (kSystemSoundID_Vibrate);
    [recorder start];
    // recorder is an AVRecorder instance.

}

关于ios - ios中的平滑触摸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32648808/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4