I have defined an object with a CGPoint ivar and associated property as follows...
@interface Sprite : NSObject {
CGRect boundingBox;
}
@property(assign) CGRect boundingBox;
When I use an instance of the Sprite class and try and update the boundingBox struct as follows...
self.boundingBox.origin.x = minX;
I receive a compile time error stating...
Lvalue required as left operand of assignment
Am I correct in saying that self.boundingBox will return a C struct, which isn't actually the struct held by the Sprite object but rather a copy of it? Therefore when the assignment of a new value for x fails because the struct is only a temporary copy?
If this is the case will the following code work correctly (and is it the correct way to achieve what I want)?
CGRect newBoundingBox = self.boundingBox;
newBoundingBox.origin.x = self.boundingBox.origin.x;
self.boundingBox = newBoundingBox;