美文网首页
iOS开发 实现手机震动

iOS开发 实现手机震动

作者: 打你胸口 | 来源:发表于2017-06-16 17:11 被阅读0次

    不要搞成病毒,让手机一直震动

    1.系统震动(整栋比较短)

    AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

    2.私有API(self.longTime我设置的20,震动比较长)

    NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];

    NSArray *pattern = @[@YES, [NSNumber numberWithInt:90 * self.longTime], @NO, @10];

    dictionary[@"VibePattern"] = pattern;

    AudioServicesPlaySystemSoundWithVibration(kSystemSoundID_Vibrate, nil, dictionary);

    相关文章

      网友评论

          本文标题:iOS开发 实现手机震动

          本文链接:https://www.haomeiwen.com/subject/vismqxtx.html