Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS - dispatcherTimer blocking touches events?
    text
    copied!<p>I am using the dispatcher source timer update a view at different frame rates. (8, 12 or 24 FPS) </p> <p>Here is the code that initializes the dispatcherTimer and the function used to create the timer.<br> (this function is directly taken from apple doc in the subsection "creating a timer": <a href="http://developer.apple.com/library/mac/#documentation/General/Conceptual/ConcurrencyProgrammingGuide/GCDWorkQueues/GCDWorkQueues.html" rel="nofollow">http://developer.apple.com/library/mac/#documentation/General/Conceptual/ConcurrencyProgrammingGuide/GCDWorkQueues/GCDWorkQueues.html</a>) </p> <p>call:</p> <pre><code> self.dispatchTimer = [self createDispatchTimerWithInterval:self.project.frameDuration * NSEC_PER_SEC leeway:0.0 * NSEC_PER_SEC queue:dispatch_get_main_queue() block:displayFrame]; </code></pre> <p>function:</p> <pre><code>- (dispatch_source_t)createDispatchTimerWithInterval:(uint64_t)interval leeway:(uint64_t)leeway queue:(dispatch_queue_t)queue block:(dispatch_block_t)block { dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue); if (timer) { dispatch_source_set_timer(timer, dispatch_walltime(NULL, 0), interval, leeway); dispatch_source_set_event_handler(timer, block); dispatch_resume(timer); } return timer; } </code></pre> <p>My view updates perfectly, but the touch events are not caught. My first bet would be that the block "displayFrame" takes too much processing time because if I reduce the frameDuration to 0.5 second or so, the touch events are caught. </p> <p>I only tested this on iOS 4 with a iPad 2. </p> <p>Any help or hint would be greatly appreciated! </p> <p>Etienne</p> <p><strong>UPDATE</strong></p> <p>I have asked a similar question on the apple developper forum, here is the answer I got: <a href="https://devforums.apple.com/thread/156633?tstart=0" rel="nofollow">https://devforums.apple.com/thread/156633?tstart=0</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload