#import <Application/Application.h>
Instance Methods | |
(id< TimerDelegate >) | - delegate |
Gets the current timer delegate. More... | |
(void) | - setDelegate: |
Sets the timer delegate. More... | |
(BOOL) | - fire |
Manually fires the timer. More... | |
(void) | - invalidate |
Invalidates and stops the timer. More... | |
(BOOL) | - valid |
Checks if the timer is still valid and active. More... | |
(NXTimeInterval) | - interval |
Gets the timer's configured time interval. More... | |
(BOOL) | - repeats |
Returns whether the timer is set to repeat. More... | |
![]() | |
(id) | - retain |
Increases the retain count of the receiver. More... | |
(void) | - release |
Decreases the retain count of the receiver. More... | |
(id) | - autorelease |
Adds the receiver to the autorelease pool. | |
![]() | |
(void) | - dealloc |
Free resources for an existing instance. | |
(id) | - init |
Initialize the instance, after allocation. More... | |
(Class) | - class |
Returns the class of the instance. More... | |
(Class) | - superclass |
Returns the superclass of the instance. More... | |
(BOOL) | - isEqual: |
Compares the receiver to another object for equality. More... | |
(BOOL) | - isKindOfClass: |
Returns a Boolean value that indicates whether the receiver is an instance of a given class. More... | |
(BOOL) | - conformsTo: |
Checks if the receiver's class conforms to a protocol. More... | |
(NXString *) | - description |
Returns a string that represents the instance. More... | |
![]() | |
(BOOL) | - respondsToSelector: |
Checks if the receiver responds to a selector. More... | |
Class Methods | |
(NXTimer *) | + timerWithInterval:repeats: |
Creates a new timer with the specified time interval and repeat behaviour. More... | |
![]() | |
(id) | + allocWithZone: |
Allocates a new instance of an object in a specific memory zone. More... | |
![]() | |
(void) | + initialize |
Performs one-time initialization for the class. More... | |
(id) | + alloc |
Allocate a new class instance. More... | |
(Class) | + class |
Returns the class object. More... | |
(Class) | + superclass |
Returns the superclass of the class. More... | |
(const char *) | + name |
Returns the name of the class. More... | |
(BOOL) | + conformsTo: |
Checks if the class conforms to a protocol. More... | |
(NXString *) | + description |
Returns a string that represents the class. More... | |
Protected Attributes | |
sys_timer_t | _timer |
Scheduled timer. | |
id< TimerDelegate > | _delegate |
The timer delegate. | |
BOOL | _repeats |
Flag to indicate if the timer should be canceled on firing. | |
NXTimeInterval | _interval |
The time interval. | |
![]() | |
id | _zone |
The memory zone where the object is allocated. | |
unsigned short | _retain |
The retain count of the object. | |
id | _next |
The next object in an autorelease pool. | |
![]() | |
Class | isa |
A pointer to the object's class structure. More... | |
The NXTimer class.
NXTimer represents a class for controlling timers.
- (id<TimerDelegate>) delegate |
Gets the current timer delegate.
This method returns the object that serves as the timer's delegate.
- (BOOL) fire |
Manually fires the timer.
This method immediately triggers the timer's firing behavior, calling the delegate's timer callback method. For repeating timers, this does not affect the regular firing schedule.
- (NXTimeInterval) interval |
Gets the timer's configured time interval.
This returns the interval that was set when the timer was created. The interval cannot be changed after timer creation.
- (void) invalidate |
Invalidates and stops the timer.
Once a timer is invalidated, it cannot be reused and will no longer fire. This method should be called to clean up timers that are no longer needed to prevent memory leaks and unwanted timer callbacks.
- (BOOL) repeats |
Returns whether the timer is set to repeat.
- (void) setDelegate: | (id< TimerDelegate >) | delegate |
Sets the timer delegate.
delegate | The object to set as the timer delegate, or nil to remove the current delegate. |
The delegate object will receive timer-related callbacks when the timer fires. The delegate should conform to the TimerDelegate protocol.
+ (NXTimer *) timerWithInterval: | (NXTimeInterval) | interval | |
repeats: | (BOOL) | repeats | |
Creates a new timer with the specified time interval and repeat behaviour.
interval | The time interval in seconds between timer firings. |
repeats | YES if the timer should repeat automatically, NO for a one-shot timer. |
This class method creates and returns a new timer configured with the specified interval and repeat behavior. The timer is not automatically scheduled - you must set a delegate to ensure the timer is properly managed.
- (BOOL) valid |
Checks if the timer is still valid and active.
A timer becomes invalid when it has been explicitly invalidated or when a non-repeating timer has already fired.