Expression is not assignable

I have an object (a custom UIView) in which I have this property in the public API:


@property (nonatomic) CGPoint theOrigin;


then, in the implementation file I have:


@synthesize theOrigin = _theOrigin;


also in the implementation file I have the method:


-(void)setDefaultOrigin {

_theOrigin.x = self.bounds.origin.x + self.bounds.size.width/2;

_theOrigin.y = self.bounds.origin.y + self.bounds.size.height/2;

}


which doesn't generate any compiler complaints but if I try to code the above method

like this:


-(void)setDefaultOrigin {

self.theOrigin.x = self.bounds.origin.x + self.bounds.size.width/2;

self.theOrigin.y = self.bounds.origin.y + self.bounds.size.height/2;

}


I get a complaint on both lines of the method stating that the "Expression is not assignable"

and it won't allow me to build. I am not understanding why I can't code it the second way.

Posted on Dec 13, 2011 5:58 AM

Reply
1 reply

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Expression is not assignable

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.