什么是ios生命周期中的事件循环,它的用途和用途是什么? [英] What is event loop in ios life cycle and what is its usage and what it does?

查看:129
本文介绍了什么是ios生命周期中的事件循环,它的用途和用途是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道ios生命周期中的事件循环是什么吗?
任何人都建议我这个吗?

I need to know what the event loop in the ios life cycle does?. Can any one suggest me regarding this??

推荐答案

最好的答案可能就是Apple提供的答案可可应用程序的主要事件循环部分适用于iOS的文档文档。

The best answer is probably the one provided by Apple in the "Main event loop" section of the Cocoa Application Competencies for iOS document.


在主事件循环中,应用程序不断将传入事件路由到对象以进行处理,处理的结果,更新其外观和状态。事件循环只是一个运行循环:一个事件处理循环,用于调度工作并协调从连接到运行循环的各种输入源接收事件。每个线程都可以访问一个运行循环。除主线程外,必须配置运行循环并由代码手动运行。在Cocoa应用程序中,主线程的运行循环 - 主事件循环 - 由应用程序对象自动运行。主要事件循环的区别在于其主要输入源接收来自操作系统的由用户操作生成的事件 - 例如,点击视图或使用键盘输入文本。

In the main event loop, an application continuously routes incoming events to objects for handling and, as a result of that handling, updates its appearance and state. An event loop is simply a run loop: an event-processing loop for scheduling work and coordinating the receipt of events from various input sources attached to the run loop. Every thread has access to a run loop. In all but the main thread, the run loop must be configured and run manually by your code. In Cocoa applications, the run loop for the main thread—the main event loop—is run automatically by the application object. What distinguishes the main event loop is that its primary input source receives events from the operating system that are generated by user actions—for example, tapping a view or entering text using a keyboard.

顺便提一下,如果你对iOS开发比较陌生,我确实推荐阅读这份文件,因为它会回答很多问题你可能有。

Incidentally, if you're relatively new to iOS development, I'd really recommend a read of this document, as it'll answer a lot of questions you probably have.

这篇关于什么是ios生命周期中的事件循环,它的用途和用途是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆