Name

NSValue — Mac OS X 10.0

Synopsis

This class provides an object-oriented interface to C and Objective-C scalar data items, such as numeric primitives, and C structures. Providing an object-oriented wrapper for these non-object types makes it possible for clients to store these types in any of the Foundation collection classes.

image with no caption

@interface NSValue : NSObject <NSCoding, NSCopying>
                                  // Convenience Constructors
   + (NSValue *)value:(const void *)value 
                                 withObjCType:(const char *)type;
   + (NSValue *)valueWithBytes:(const void *)value 
                                 objCType:(const char *)type;
   + (NSValue *)valueWithNonretainedObject:(id)anObject;
   + (NSValue *)valueWithPoint:(NSPoint)point;
   + (NSValue *)valueWithPointer:(const void *)pointer;
   + (NSValue *)valueWithRange:(NSRange)range;
   + (NSValue *)valueWithRect:(NSRect)rect;
   + (NSValue *)valueWithSize:(NSSize)size;
                                  // Initializers
   - (id)initWithBytes:(const void *)value 
                                 objCType:(const char *)type;
                                  // Instance Methods
   - (void)getValue:(void *)value;
   - (BOOL)isEqualToValue:(NSValue *)value;
   - (id)nonretainedObjectValue;
   - (const char *)objCType;
   - (NSPoint)pointValue;
   - (void *)pointerValue;
   - (NSRange)rangeValue;
   - (NSRect)rectValue;
   - (NSSize)sizeValue;
                                  // Methods Implementing NSCoding
   - (void)encodeWithCoder:(NSCoder *)aCoder;
   - (id)initWithCoder:(NSCoder *)aDecoder;
                                  // Methods Implementing NSCopying
   - (id)

Get Cocoa in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.