您的位置:首页 > 其它

调用手机震动

2016-04-27 18:58 267 查看
所谓调用手机的震动,其实就是调用系统声音的一种。就一句代码:

  AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

仅支手机(ipnone)。    ipad 、touch 都不支持

 NSString *devieModel = [[UIDevice currentDevice]model];
    NSLog(@"device %@",devieModel);

    
 
  if ([devieModel isEqualToString:@"iPhone"])
    {
        AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
    }else
    {
        UIAlertView *alerView = [[UIAlertView alloc]initWithTitle:@"warning" message:@"Your device is not supported" delegate:self cancelButtonTitle:@"ok" otherButtonTitles:
nil];

        [alerView show];
    }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息