haptics
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHaptics
触觉反馈
Haptic feedback provides tactile confirmation of user actions and system events. When designed thoughtfully, haptics transform interfaces from functional to delightful.
触觉反馈为用户操作和系统事件提供触觉确认。经过精心设计的触觉反馈能让界面从功能性提升至愉悦感。
Overview
概述
Haptics should enhance interactions, not dominate them. The core principle: haptic feedback is like sound design—every haptic should have purpose (confirmation, error, warning), timing (immediate or delayed), and restraint (less is more).
触觉反馈应增强交互体验,而非喧宾夺主。核心原则:触觉反馈如同音效设计——每一次触觉反馈都应具备明确目的(确认、错误、警告)、精准时机(即时或延迟)和克制性(少即是多)。
Reference Loading Guide
参考资料加载指南
ALWAYS load reference files if there is even a small chance the content may be required. It's better to have the context than to miss a pattern or make a mistake.
| Reference | Load When |
|---|---|
| UIFeedbackGenerator | Using simple impact/selection/notification haptics |
| Core Haptics | Creating custom patterns with CHHapticEngine |
| AHAP Patterns | Working with Apple Haptic Audio Pattern files |
| Design Principles | Applying Causality, Harmony, Utility framework |
只要有哪怕一丝可能需要用到相关内容,就务必加载参考文件。 提前获取上下文总好过遗漏模式或出错。
| 参考资料 | 加载时机 |
|---|---|
| UIFeedbackGenerator | 使用简单的碰撞/选择/通知类触觉反馈时 |
| Core Haptics | 使用CHHapticEngine创建自定义触觉模式时 |
| AHAP Patterns | 处理Apple Haptic Audio Pattern文件时 |
| Design Principles | 应用因果性、协调性、实用性框架时 |
Core Workflow
核心工作流程
- Choose complexity level: Simple (UIFeedbackGenerator) vs Custom (Core Haptics)
- For simple haptics: Use UIImpactFeedbackGenerator, UISelectionFeedbackGenerator, or UINotificationFeedbackGenerator
- For custom patterns: Create CHHapticEngine, define CHHapticEvents, build CHHapticPattern
- Prepare before triggering: Call to reduce latency
prepare() - Apply design principles: Ensure Causality (timing), Harmony (multimodal), Utility (meaningful)
- 选择复杂程度:简单模式(UIFeedbackGenerator) vs 自定义模式(Core Haptics)
- 简单触觉反馈:使用UIImpactFeedbackGenerator、UISelectionFeedbackGenerator或UINotificationFeedbackGenerator
- 自定义模式:创建CHHapticEngine、定义CHHapticEvents、构建CHHapticPattern
- 触发前准备:调用以降低延迟
prepare() - 应用设计原则:确保具备因果性(时机)、协调性(多模态)、实用性(有意义)
System Requirements
系统要求
- iOS 10+ for UIFeedbackGenerator
- iOS 13+ for Core Haptics (CHHapticEngine)
- iPhone 8+ for Core Haptics hardware support
- Physical device required - haptics cannot be tested in Simulator
- iOS 10+ 支持UIFeedbackGenerator
- iOS 13+ 支持Core Haptics(CHHapticEngine)
- iPhone 8+ 具备Core Haptics硬件支持
- 需使用物理设备 - 模拟器无法测试触觉反馈
Common Mistakes
常见误区
-
Haptic feedback on every action — Every button doesn't need haptics. Reserve haptics for critical confirmations (purchase, delete, settings change). Over-haptics are annoying and drain battery.
-
Triggering haptics on main thread blocks — Long haptic patterns can freeze UI briefly. Use background threads or async for Core Hapticscalls to prevent jank.
prepare() -
Haptic without audio/visual feedback — Relying ONLY on haptics means deaf or deaf-blind users miss feedback. Always pair haptics with sound or visual response.
-
Ignoring haptic settings — Some users disable haptics system-wide. Checkbefore triggering. Graceful degradation is required.
UIFeedbackGenerator.isHapticFeedbackEnabled -
AHAP file errors silently — Invalid AHAP files fail silently without errors. Test with Xcode's haptic designer and validate file syntax before shipping.
-
Forgetting battery impact — Continuous haptic patterns (progress bars, loading states) drain battery fast. Use haptics for state changes only, not ongoing feedback.
-
每个操作都添加触觉反馈 — 并非所有按钮都需要触觉反馈。应将触觉反馈保留给关键确认操作(购买、删除、设置更改)。过度使用触觉反馈会令人反感,还会消耗电量。
-
在主线程触发触觉反馈导致阻塞 — 较长的触觉模式可能会短暂冻结UI。使用后台线程或异步调用Core Haptics的方法,以避免界面卡顿。
prepare() -
仅依赖触觉反馈,无音频/视觉反馈 — 仅使用触觉反馈会导致失聪或聋盲用户无法获取反馈。务必将触觉反馈与声音或视觉响应搭配使用。
-
忽略触觉设置 — 部分用户会在系统层面禁用触觉反馈。触发前请检查。需要提供优雅的降级方案。
UIFeedbackGenerator.isHapticFeedbackEnabled -
AHAP文件错误无提示 — 无效的AHAP文件会静默失败,不会抛出错误。上线前请使用Xcode的触觉设计器测试并验证文件语法。
-
忽略电池影响 — 持续的触觉模式(进度条、加载状态)会快速消耗电量。仅在状态变化时使用触觉反馈,而非持续反馈。