Alex Rivera | Logout

Getting CGRect from array

Asked 2011-03-25T11:03:14.050
12

For my application I am trying to store CGRect objects into an NSMutableArray. It is loading well and printing in the log statement, but trying to take the CGRects from the array shows an error. Here is a code snippet:

CGRect lineRact = CGRectMake([[attributeDict objectForKey:@"x"] floatValue], 
  [[attributeDict objectForKey:@"y"] floatValue], 
  [[attributeDict objectForKey:@"width"] floatValue], 
  [[attributeDict objectForKey:@"height"] floatValue]);

  [lineRactangle addObject:NSStringFromCGRect(lineRact)];

How can I get the rects back from the array?

Edit
Report

1 Answer

21
[lineRactangle addObject:[NSValue valueWithCGRect:lineRect]];
answered 2011-03-25T11:08:47.580

Your Answer