I am using an NSArray which contains CGRect values. Is there any way to get the greatest width of all the rects contained in the array through library methods, or do I have to implement my own logic? Thanks in advance.
Code sample:
for (int i=0; i<[array1 count]; i++) {
CGRect rect = [[array1 objectAtIndex:i] CGRectValue];
// Here, some transformation of rects
[array2 addObject:[NSValue valueWithCGRect:rect]];
}
In this code I am trying to take frames from array1 and add them to array2. I am getting the frames in array1 from XML. I parsed those frames and placed them in the array. I provided my code as a very simple way.
Don’t send a
-countmessage to your array over and over like that. It’s wasteful.