Instance Method

removeTimeObserver:

Cancels the specified time observer.

Declaration

- (void)removeTimeObserver:(id)observer;

Parameters

observer

The time observer to be cancelled.

Discussion

Use this method to explicitly cancel time observers added using addPeriodicTimeObserverForInterval:queue:usingBlock: or addBoundaryTimeObserverForTimes:queue:usingBlock:

Upon return, the caller is guaranteed that no new time observer blocks will begin executing. Depending on the calling thread and the queue used to add the time observer, an in-flight block may continue to execute after this method returns. You can guarantee synchronous time observer removal by enqueuing the call to removeTimeObserver: on that queue. Call dispatch_sync after removeTimeObserver: to wait for any in-flight blocks to finish executing.

See Also

Working with Time Observers

- addBoundaryTimeObserverForTimes:queue:usingBlock:

Requests invocation of a block when specified times are traversed during normal rendering.

- addPeriodicTimeObserverForInterval:queue:usingBlock:

Requests invocation of a block during rendering at specified time intervals.