D
D
Dreddik2012-02-03 19:19:36
iOS
Dreddik, 2012-02-03 19:19:36

IOs: ARC and NSTimer?

Hello!
There was a following problem with ARC. Some code is used in the view:

timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timerFireMethod:) userInfo:nil repeats:YES];

The problem starts when the view is deleted in the controller, but the timer's strong reference prevents it (the view) from being deleted.
Is there any way to track when the reference count has changed when using ARC (like retainCount used to)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dreddik, 2012-02-03
@Dreddik

The question is irrelevant, killing the timer placed in:

-(void)removeFromSuperview 
{
    [self killTimer];
    [super removeFromSuperview];
}
-(void) killTimer 
{
    [timer invalidate];
    timer = nil;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question