daveverwer / NSDictionaryCGStructs

Home Page:http://shinydevelopment.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hopefully this will be useful to some people, simple CGPoint, CGSize and CGRect storage and retrieval from NSDictionary.

To store values into a NSMutableDictionary:

NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
[dictionary setPoint:CGPointMake(100, 200) forKey:@"pointValue"];
[dictionary setSize:CGSizeMake(500, 600) forKey:@"sizeValue"];
[dictionary setRect:CGRectMake(10, 20, 50, 60) forKey:@"rectValue"];

To retrieve values from a NSDictionary:

CGPoint point = [newDictionary pointForKey:@"pointValue"];
CGSize size = [newDictionary sizeForKey:@"sizeValue"];
CGRect rect = [newDictionary rectForKey:@"rectValue"];

About

http://shinydevelopment.com

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Objective-C 87.6%Language:C 12.4%