I have an array, full of CGRects. That part is fine. The problem is when I go to retrieve the CGRects from the array, I'm getting weird errors. Check out my code.
NSArray *frameLocations = [NSArray arrayWithObjects:
[NSValue valueWithCGRect:CGRectMake(20, 20, 121, 124)],
[NSValue valueWithCGRect:CGRectMake(176, 20, 121, 124)],
nil];
Than I get the frame in a for loop, like this:
CGRect *imageFrame = [[frameLocations objectAtIndex:i] CGRectValue];
I've tried a bunch of different variations, spreading that line out over multiple variables. But I can't seem to get it.
Try:
CGRect imageFrame = [[frameLocations objectAtIndex:i] CGRectValue];
You get an actual CGRect back, not a pointer to a CGRect, because it's a primitive C-style type, not an Objective-C object.
Apart from that your code looks correct.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With