0407--iOS之Touches, Presses, and Gestures目录大纲

本文详细介绍了在iOS应用开发中,如何使用UIKit处理各种触控事件和手势,包括多点触控、Apple Pencil输入、3D Touch以及自定义手势识别。通过封装事件处理逻辑于手势识别器中,开发者能在应用中实现一致且可重用的用户交互体验。

Touches, Presses, and Gestures

Encapsulate your app's event-handling logic in gesture recognizers so that you can reuse that code throughout your app.

--将app的事件处理逻辑封装在手势识别器中,以便可以在整个app中重用该代码。

 

Overview

If you build your apps using standard UIKit views and controls, UIKit automatically handles touch events (including Multitouch events) for you. However, if you use custom views to display your content, you must handle all touch events that occur in your views. There are two ways to handle touch events yourself.
    --如果您使用标准的UIKit视图和控件构建应用程序,UIKit会自动为您处理触摸事件(包括多点触摸事件)。但是,如果使用自定义视图显示内容,则必须处理视图中发生的所有触摸事件。有两种方法可以自己处理触摸事件。

  • Use gesture recognizers to track the touches; see Handling UIKit Gestures.
    --使用手势识别器来跟踪触摸事件,参考超链接:处理UIKit的手势

  • Track the touches directly in your UIView subclass; see Handling Touches in Your View.
    --直接在UIView子类中跟踪触摸;请参见超链接:在视图中处理触摸

Topics                                 --专题

First Steps                      --第一步

 

Using Responders and the Responder Chain to Handle Events                 --使用在响应者链中的响应者来响应事件

Learn how to handle events that propagate through your app.

 

class UIResponder                                --响应者类

An abstract interface for responding to and handling events.

 

class UIEvent                           --时间类

An object that describes a single user interaction with your app.

 

Touches                              --触摸

 

Handling Touches in Your View

Use touch events directly on a view subclass if touch handling is intricately linked to the view's content.

 

Handling Input from Apple Pencil

Learn how to detect and respond to touches from Apple Pencil.

 

Tracking the Force of 3D Touch Events

Manipulate your content based on the force of touches.

 

Illustrating the Force, Altitude, and Azimuth Properties of Touch Input

Capture Apple Pencil and touch input in views.

 

Leveraging Touch Input for Drawing Apps

Capture touches as a series of strokes and render them efficiently on a drawing canvas.

class UITouch

An object representing the location, size, movement, and force of a touch occurring on the screen.

 

Button Presses                       --按钮按压

class UIPress

An object that represents the presence or movement of a button press on the screen for a particular event.

class UIPressesEvent

An event that describes the state of a set of physical buttons that are available to the device, such as those on an associated remote or game controller.

 

Standard Gestures                     --标准手势

 

Handling UIKit Gestures

Use gesture recognizers to simplify touch handling and create a consistent user experience.

 

Coordinating Multiple Gesture Recognizers

Discover how to use multiple gesture recognizers on the same view.

class UIHoverGestureRecognizer

A gesture recognizer that looks for pointer movement over a view.

class UILongPressGestureRecognizer

A concrete subclass of UIGestureRecognizer that looks for long-press gestures.

class UIPanGestureRecognizer

A concrete subclass of UIGestureRecognizer that looks for panning (dragging) gestures.

class UIPinchGestureRecognizer

A concrete subclass of UIGestureRecognizer that looks for pinching gestures involving two touches.

class UIRotationGestureRecognizer

A concrete subclass of UIGestureRecognizer that looks for rotation gestures involving two touches.

class UIScreenEdgePanGestureRecognizer

A gesture recognizer that looks for panning (dragging) gestures that start near an edge of the screen.

class UISwipeGestureRecognizer

A concrete subclass of UIGestureRecognizer that looks for swiping gestures in one or more directions.

class UITapGestureRecognizer

A concrete subclass of UIGestureRecognizer that looks for single or multiple taps.

 

Custom Gestures                     --用户自定义手势

 

Implementing a Custom Gesture Recognizer

Discover when and how to build your own gesture recognizers

class UIGestureRecognizer

The base class for concrete gesture recognizers.

protocol UIGestureRecognizerDelegate

A set of methods implemented by the delegate of a gesture recognizer to fine-tune an app’s gesture-recognition behavior.

 

3D Touch Interactions                     --3D触摸交互

class UIPreviewInteraction

A class that registers a view to provide a custom user experience in response to 3D Touch interactions.

protocol UIPreviewInteractionDelegate

A set of methods for communicating the progress of a preview interaction.

protocol UIPreviewActionItem

A set of methods that defines the styles you can apply to peek quick actions and peek quick action groups, and defines a read-only accessor for the user-visible title of a peek quick action.

 

See Also

User Interactions

 

Drag and Drop

Bring drag and drop to your app by using interaction APIs with your views.

 

Pointer Interactions

Support pointer interactions in your custom controls and views.

 

Pencil Interactions

Handle double-tap user interactions on Apple Pencil.

 

Focus-based Navigation

Navigate the interface of your UIKit app using a remote or a game controller.

 

Menus and Shortcuts

Simplify interactions with your app using menu systems, contextual menus, Home screen quick actions, and keyboard shortcuts.

 

Accessibility

Make your apps accessible to everyone, including people with disabilities.

内容概要:本文围绕微电网群的双层优化与分布式优化问题,提出基于交替方向乘子法(ADMM)的分布式协同优化控制策略,并通过Matlab代码实现仿真验证。研究构建了上层为微电网间能量协调与优化调度、下层为各微电网内部源--储精细化运行管理的双层优化模型。采用ADMM算法将集中式优化问题分解为多个可并行求解的子问题,实现了计算的分布式化与信息隐私保护,显著提升了系统的可扩展性与鲁棒性。文中系统阐述了模型构建原理、ADMM算法设计流程及其收敛性分析,并通过仿真实验验证了该方法在降低系统综合运行成本、提高可再生能源消纳能力以及维持系统稳定运行方面的有效性。; 适合人群:具备电力系统分析、优化理论基础,熟悉Matlab编程,从事微电网、分布式能源系统、智能电网等领域研究的研究生、科研人员及工程技术人员。; 使用场景及目标:① 学习和掌握基于ADMM的分布式优化方法在微电网群协同能量管理中的具体应用;② 实现微电网群多主体参与下的经济调度与仿真分析;③ 深入理解双层优化架构的设计理念与分布式求解算法的实现机制。; 阅读建议:建议结合所提供的Matlab代码进行动手实践,重点剖析模型建立与算法实现的关键细节,可通过调整系统参数、改变运行场景等方式,深入探究ADMM算法的收敛特性及其对优化效果的影响。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值