• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSImageView gets stuck
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSImageView gets stuck
      • From: Michael Rogers <email@hidden>
References: 
 >cocoa class diagram (From: "macdev" <email@hidden>)
 >Re: cocoa class diagram (From: "Kyle Sluder" <email@hidden>)
 >NSImageView gets stuck (From: Michael Rogers <email@hidden>)

  • Prev by Date: Re: Array Controller Add method question
  • Next by Date: Re: Array Controller Add method question
  • Previous by thread: NSImageView gets stuck
  • Next by thread: Re: NSImageView gets stuck
  • Index(es):
    • Date
    • Thread