Class: CADisplayLink

Inherits:
NSObject show all

Overview

A CADisplayLink object is a timer object that allows your application to synchronize its drawing to the refresh rate of the display.

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from NSObject

#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version

Constructor Details

This class inherits a constructor from NSObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NSObject

Instance Attribute Details

- (CFTimeInterval) duration (readonly)

The time interval between screen refresh updates. (read-only) The value for duration is undefined before the target’s selector has been called at least once. Your application can calculate the amount of time it has to render each frame by multiplying duration by frameInterval.

Returns:

  • (CFTimeInterval)

- (Integer) frameInterval

The number of frames that must pass before the display link notifies the target again. The default value is 1, which results in your application being notified at the refresh rate of the display. If the value is set to a value larger than 1, the display link notifies your application at a fraction of the native refresh rate. For example, setting the interval to 2 causes the display link to fire every other frame, providing half the frame rate.Setting this value to less than 1 results in undefined behavior and is a programmer error.

Returns:

- (Boolean) paused

A Boolean value that states whether the display link’s notifications to the target are suspended. The default value is NO. If YES, the display link does not send notifications to the target.

Returns:

  • (Boolean)

- (CFTimeInterval) timestamp (readonly)

The time value associated with the last frame that was displayed. (read-only) The target should use the value of this property to calculate what should be displayed in the next frame.

Returns:

  • (CFTimeInterval)

Class Method Details

+ (CADisplayLink) displayLinkWithTarget(target, selector:sel)

Returns a new display link. The selector to be called on the target must be a method with the following signature:where sender is the display link returned by this method.The newly constructed display link retains the target.

Parameters:

  • target (Object)

    An object to be notified when the screen should be updated.

  • sel (Symbol)

    The method to call on the target.

Returns:

Instance Method Details

- (Object) addToRunLoop(runloop, forMode:mode)

Registers the display link with a run loop. You can associate a display link with multiple input modes. While the run loop is executing in a mode you have specified, the display link notifies the target when new frames are required.The run loop retains the display link. To remove the display link from all run loops, send an invalidate message to the display link.

Parameters:

  • runloop (NSRunLoop)

    The run loop to associate with the display link.

  • mode (String)

    The mode in which to add the display link to the run loop. You may specify a custom mode or use one of the modes listed in NSRunLoop Class Reference.

Returns:

- (Object) invalidate

Removes the display link from all run loop modes. Removing the display link from all run loop modes causes it to be released by the run loop. The display link also releases the target.

Returns:

- (Object) removeFromRunLoop(runloop, forMode:mode)

Removes the display link from the run loop for the given mode. The run loop releases the display link if it is no longer associated with any run modes.

Parameters:

  • runloop (NSRunLoop)

    The run loop associated with the display link.

  • mode (String)

    The run loop mode in which the display link is running.

Returns: