Question

Actually I have a Xml file, after xml parsing,I get the values for frame position and frame size.I stored those values in an arra. now I have to give the array values for my imageview,so I need to convert those values into CGRect.,The NSlog shows "my frame is ( 0, 0 ), ( 768, 1024 )"

Can any one please help me out.

Was it helpful?

Solution

To store CGPoint in NSArray:

NSArray *points = [NSArray arrayWithObjects:[NSValue valueWithCGPoint:CGPointMake(5.5, 8.3)],[NSValue valueWithCGPoint:CGPointMake(11.9, 8.5)],nil];

To retrieve CGPoint from array:

From array to cgPoint variable.

NSValue *val = [points objectAtIndex:0];
CGPoint p = [val CGPointValue];

This may helping to you

Happy codeing

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top