【发布时间】:2021-01-19 08:09:29
【问题描述】:
现在我有一个扩展程序可以让设备在应用程序的任何位置振动:
extension UIDevice {
static func vibrate(style: UINotificationFeedbackGenerator.FeedbackType) {
guard CHHapticEngine.capabilitiesForHardware().supportsHaptics else {
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)
return
}
let generator = UINotificationFeedbackGenerator()
generator.notificationOccurred(style)
}
}
问题出在使用触觉的设备上。现在我使用风格为warning
但设备振动非常微弱,甚至不明显。是否有其他方法可以使设备振动 2 次或更剧烈?
我在代码中尝试了不同的振动方式,但振动仍然很弱。
【问题讨论】:
-
更多内脏?还是更激烈?
-
对不起,更激烈
-
您可以随时使用
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate),这是一个非常重的振动。
标签: ios swift iphone haptic-feedback