Table of Contents

valueWithCGRect

 
+ (NSValue *)valueWithCGRect:(CGRect)rect;
 

Creates and returns an NSValue object that contains the value of a CGRect.

Return Value - A new NSValue object.

ObjC Sourcecode Example

    //** Sample datatype **
    CGRect aRect = CGRectMake(0.0f, 0.0f, 150.0f, 200.0f);
 
    // ** Create nsvalue object **
    NSValue *cgRectValue = [NSValue valueWithCGRect:aRect];
 
    // ** Output **
    NSLog(@"%@", cgRectValue);

Output for this example code

2012-12-17 23:18:38.744 NSValueSample[340:11303] NSRect: {{0, 0}, {150, 200}}