1 <AudioToolbox/AudioToolbox.h>框架中的震动
一般的震动 AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)
1
普通的震动,类似3DTouch(Peek)
AudioServicesPlaySystemSound(1519);
普通的震动,类似3DTouch(Pop)
AudioServicesPlaySystemSound(1520);
连续三次的短震动
AudioServicesPlaySystemSound(1521);
2 iOS10 后震动方法 UIImpactFeedbackGenerator
UIImpactFeedbackGenerator *generator = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleHeavy];
[generator impactOccurred];
枚举定义震动强度
typedef NS_ENUM(NSInteger, UIImpactFeedbackStyle) {
UIImpactFeedbackStyleLight,
UIImpactFeedbackStyleMedium,
UIImpactFeedbackStyleHeavy,
UIImpactFeedbackStyleSoft API_AVAILABLE(ios(13.0)),
UIImpactFeedbackStyleRigid API_AVAILABLE(ios(13.0))
};
网友评论