开发者

UIEvent timestamp

开发者 https://www.devze.com 2023-02-02 13:36 出处:网络
When handling a UIButton touch, you are given a UIEvent object.The UIEvent object has a timestamp which the Apple documentation states as being \"the time that the event was created\" (UIEvent Class R

When handling a UIButton touch, you are given a UIEvent object. The UIEvent object has a timestamp which the Apple documentation states as being "the time that the event was created" (UIEvent Class Reference). In the documentation on the Main Event Loop, it states that: "The application object obtains the topmost object in the event queue, converts it to a开发者_如何学Cn event object (UIEvent) ..."

Does [UIEvent timestamp] refer to the time at which the UIEvent object is created (i.e. after processing the touch event off of the main run loop and hance not remotely real-time) or does it refer to the time that the underlying touch object was created (and hence as close as possible to representing the actual time of the user touch9?


If you want to check, setup a view to log the timestamps of the touches, and then configure a button to lock the main thread for a few seconds (get a for loop to count to a 100 million).

While the main thread is spinning, tap your logging view, then examine the timestamps- if they're evenly spaced the OS does the timestamp, and it's accurate.

0

精彩评论

暂无评论...
验证码 换一张
取 消