NSTimer not fired when uiscrollview event occurs

前端 未结 2 459
野趣味
野趣味 2020-12-01 08:35

I have a UIImageView placed in UIScrollView, Basicly this UIImageView holds very big map, and created animation on a predefined path with \"arrows\" pointed navigation direc

2条回答
  •  臣服心动
    2020-12-01 08:59

    One more thing (c)

    1. use timerWithTimeInterval method in order to avoid adding timer to runloop in DefaultMode
    2. use mainRunLoop

    So:

    self.myTimer = [NSTimer timerWithTimeInterval:280 target:self selector:@selector(doStuff) userInfo:nil repeats:NO]; [[NSRunLoop mainRunLoop] addTimer:self.myTimer forMode:NSRunLoopCommonModes];

提交回复
热议问题