iPhone - NSTimer not repeating after fire

前端 未结 8 1810
被撕碎了的回忆
被撕碎了的回忆 2021-02-19 16:14

I am creating and firing a NSTimer with:

ncTimer = [NSTimer scheduledTimerWithTimeInterval:1.0
                                           target:sel         


        
8条回答
  •  温柔的废话
    2021-02-19 16:56

    Assigning to ncTimer as you have will not initiate the properties retain functionality.

    Assuming the declaration is within the member object you will need to do:

    self.ncTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(handleTimer:) userInfo:nil repeats:YES]
    

提交回复
热议问题