iOS开发 实现手机震动

2017-06-16  本文已影响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);

上一篇下一篇

猜你喜欢

热点阅读