为什么在主线程上绘制UI? [英] Why is UI drawn on main thread?

查看:73
本文介绍了为什么在主线程上绘制UI?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在所有UIKit绘图或AppKit绘图都在主线程上完成的原因?

Is there a reason why all the UIKit drawing or AppKit drawing is done on main thread ?

推荐答案

因为多线程绘图很快变得太复杂/令人困惑",只是答案的一半.

"Because multithreaded drawing quickly becomes too complex/confusing" is only half the answer.

多线程UI管理的另一个主要障碍是事件处理.具体来说,将事件处理混合到并发工程图中.您将不得不以某种方式将绘图与混乱相融合,而混乱是猴子在屏幕/键盘/鼠标上猛烈抨击的同时有效地保持了交易完整性的概念.

The other major impediment to multithreaded UI management is event handling. Mixing processing of events into concurrent drawing, specifically. You would have to somehow intermingle drawing with the chaos that is a monkey bashing on screen/keyboard/mouse while effectively maintaing a notion of transactional integrity.

已经很困难了,没有并发性.

Already, this is hard without concurrency.

这篇关于为什么在主线程上绘制UI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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