Moving NSRects

Discussion in 'Mac Programming' started by the ev, Jun 16, 2008.

  1. the ev macrumors newbie

    Jun 14, 2008
    How does one do it?

    myNSRect.origin.x = (float) moveToNewXCoordinate;
    ...never seems to work. :(
  2. kpua macrumors 6502

    Jul 25, 2006
    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).
  3. the ev thread starter macrumors newbie

    Jun 14, 2008
    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:

Share This Page