iOS开发 实现手机震动

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

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开发 实现手机震动)