Re: NSImageView gets stuck
Re: NSImageView gets stuck
- Subject: Re: NSImageView gets stuck
- From: email@hidden
- Date: Sat, 06 Dec 2008 22:52:21 -0500
Shot in the dark here...
I noticed you are using ballFrame in your timer event, but not in your
"reset" event.
Is that your issue?
Quoting Michael Rogers <email@hidden>:
Hi, All:
I have an NSImageView (in a variable called ball) that I am trying to
move programatically across the screen, and when it hits a wall,
reposition it in the center. I've set up an NSTimer, and in the
timerFireMethod have this:
NSRect ballFrame = [ball frame];
ballFrame.origin.x+=ballDeltaX; // move the ball
ballFrame.origin.y+=ballDeltaY;
works just fine, the ball merrily moves across the NSView. However,
when I hit the wall, and do the following:
[myController victoryGoesTo:'R'];
[timer invalidate];
[self placeBallInCenter];
the placeBallInCenter method fails:
-(void)placeBallInCenter{
[ball setFrameOrigin:NSMakePoint(125,125)];
NSLog(@"ball frame: %@",NSStringFromRect([ball frame]));
}
The ball's origin displays correctly in the console as (125,125), but
the ball is stuck on the right hand side of the screen, at around 400.
I'm using the same technique in placeBallInCenter as I did in my
timerFireMethod, so I am perplexed.
Thanks for any enlightenment,
Michael
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden