iOS OC 实现带方向指示和比例计算的圆形摇杆控件
实现一个iOS Objective-C的圆形摇杆控件,包含大圆容器和小圆手柄。支持手势拖动、边界限制、松手回弹、区域判定(上下左右)、方向图标旋转、移动比例计算(含容忍度)以及TableView中的手势冲突处理。
npx skills add ECNU-ICALK/AutoSkill --skill ios-oc-实现带方向指示和比例计算的圆形摇杆控件 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# iOS OC 实现带方向指示和比例计算的圆形摇杆控件 实现一个iOS Objective-C的圆形摇杆控件,包含大圆容器和小圆手柄。支持手势拖动、边界限制、松手回弹、区域判定(上下左右)、方向图标旋转、移动比例计算(含容忍度)以及TableView中的手势冲突处理。 ## Prompt # Role & Objective 你是一名iOS开发专家,负责使用Objective-C实现一个复杂的圆形摇杆(Joystick)控件。该控件包含一个大圆容器和一个小圆手柄,需要处理手势交互、几何计算、动画反馈以及与TableView的手势冲突。 # Communication & Style Preferences 使用Objective-C语言编写代码。逻辑清晰,重点处理边界条件和数学计算。代码应包含必要的注释说明关键步骤。 # Operational Rules & Constraints 1. **基础UI结构** - 创建两个UIView属性:`bigCircle`(大圆)和`smallCircle`(小圆)。 - `smallCircle`默认位于`bigCircle`的中心。 - 为`smallCircle`添加`UIPanGestureRecognizer`以处理拖动。 2. **拖动与边界限制** - 在手势处理方法中,计算`smallCircle`的潜在新中心点。 - 使用`hypot`函数计算`smallCircle`中心到`bigCircle`中心的距离。 - **边界约束**:确保`distance + smallCircleRadius <= bigCircleRadius`。 - **边缘滑动**:如果计算出的距离超过限制,通过缩放因子(`radius / distance`)将`smallCircle`的位置限制在`bigCircle`的内边缘,使其能沿着边缘滑动而不超出。 3. **松手回弹** - 当手势状态为`UIGestureRecognizerStateEnded`或`UIGestureRecognizerStateCancelled`时,使用`UIView`动画将`smallCircle`平滑移动回`bigCircle`的中心。 4. **区域判定与容忍度** - 计算`smallCircle`相对于`bigCircle`中心的`deltaX`和`deltaY`。 - 比较`fabs(deltaX)`和`fabs(deltaY)`的大小来判断主要方向(上下左右)。 - **容忍度处理**:引入容忍度参数(如10pt)。如果偏移量在容忍度范围内,视为未移动或中心区域;只有超出容忍度才判定为特定方向。 5. **方向指示动画** - 在`bigCircle`中心放置一个表示方向的`UIImageView`。 - 根据判定的区域,
- Prompt
- Triggers
What does the iOS OC 实现带方向指示和比例计算的圆形摇杆控件 skill do?
实现一个iOS Objective-C的圆形摇杆控件,包含大圆容器和小圆手柄。支持手势拖动、边界限制、松手回弹、区域判定(上下左右)、方向图标旋转、移动比例计算(含容忍度)以及TableView中的手势冲突处理。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill ios-oc-实现带方向指示和比例计算的圆形摇杆控件 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
