Recepción de mensajes de delegados mientras se desplaza/zoomiza

I have a custom UIView which is a delegate of an another class, that constantly sends messages to it (updating the text of an UILabel). This custom view also has an UIScrollView as a subview. The problem is that, while I pan/pinch the scrollview, no delegate messages are received (only after the interaction has finished).

How could I make it receive messages all the time?

This is how the other class sends messages to it's delegate:

   [NSTimer scheduledTimerWithTimeInterval:1.0

   - (void)onTick:(NSTimer *)timer {
       NSString *label = ...

       if ([delegate respondsToSelector:@selector(updateLabelText:)]) {
           [delegate updateLabelText:label];
           [delegate updateLabelText:label];



preguntado el 28 de agosto de 12 a las 09:08

Multithreading, using Grand Central Dispatch or NSOperation. But be sure to do the UI work in the main thread/queue! -

Gesture tracking is done in a special run loop mode. How/when does your "other class" sends the delegate messages? If via a timer etc., you may need to add that timer to the appropriate run loop mode. See Apple's NSRunLoop reference & Threading Programming Guide. -

Thanks @Jens Kilian! You are right! -

2 Respuestas

Add a UIPanGestureRecognizer/UIPinchGestureRecognizer to your UIScrollView and listen delegates method:

Regulating Gesture Recognition
– gestureRecognizerShouldBegin:
– gestureRecognizer:shouldReceiveTouch:
Controlling Simultaneous Gesture Recognition
– gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:

Respondido 28 ago 12, 09:08

I don't want to add any custom UIGestureRecognizer. I want to rely on the scrollview's default scrolling/zooming behavior. - desarrollador110

Usar [[NSRunLoop currentRunLoop] addTimer:timer forMode:UITrackingRunLoopMode]; solves the problem. Thanks @Jens Kilian!

Respondido 28 ago 12, 09:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.