PDA

View Full Version : Moving NSRects




the ev
Jun 16, 2008, 02:01 PM
How does one do it?

myNSRect.origin.x = (float) moveToNewXCoordinate;

...never seems to work. :(



kpua
Jun 16, 2008, 02:07 PM
Your question is too vague. What do you mean by "doesn't work"? There shouldn't be anything wrong with the assignment (verify with an NSLog() + NSStringFromRect() before and after).

the ev
Jun 16, 2008, 02:46 PM
Your question is too vague. What do you mean by "doesn't work"? There shouldn't be anything wrong with the assignment (verify with an NSLog() + NSStringFromRect() before and after).

My apologies about the vagueness. After reviewing the NSLog(NSStringFromRect(myNSRect)); messages I determined that I was, indeed, moving the NSRect, which then lead me to realize that my problem was resetting the frame of my other element (the frame of which I used for the basis of my NSRect), which I wasn't doing.

[self setFrame: myNSRect]

That was the piece I was missing. Thanks for the heads-up on the NSStringFromRect() method...and your patience! (If you couldn't tell, I'm still a newbie at all of this). :rolleyes: