• 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: [Bulk] Re: Custom NSView not redrawing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Bulk] Re: Custom NSView not redrawing


  • Subject: RE: [Bulk] Re: Custom NSView not redrawing
  • From: "Steven E Barnes" <email@hidden>
  • Date: Tue, 18 Dec 2007 23:12:05 -0800

Thanks, that was the problem.  I had an unneeded instance in the NIB.
Apparently embedding the view in the window creates an instance, and I had
also created one manually.

> -----Original Message-----
> From: j o a r [mailto:email@hidden]
> Sent: Tuesday, December 18, 2007 10:45 PM
> To: Steven E Barnes
> Subject: [Bulk] Re: Custom NSView not redrawing
>
>
> On Dec 18, 2007, at 1:58 PM, Steven E Barnes wrote:
>
> > I am attempting to write a simple game using
> > Objective-C and Cocoa, currently on Tiger.  I have a
> > simple game thread using NSThread which looks like
> > this:
> >
> > - (void) doAnim {
> > 	NSDate *date = nil;
> > 	@try {
> > 		while (animating) {
> > 			[world advanceClock:ANIM_TICK_INTERVAL];
> >
> > 			[[GameView instance] setNeedsDisplay:YES];
> >
> > 			date = [NSDate
> > dateWithTimeIntervalSinceNow:ANIM_TICK_INTERVAL];
> > 			[NSThread sleepUntilDate:date];
> >
> > 		}
> > 	}
> > 	@catch(NSException *e) {
> > 		NSLog(@"Caught %@: %@", [e name], [e reason]);
> > 	}
> > }
>
>
> As you point out, this is not a thread safe call, and that's
> something
> you need to fix. It might not be directly related to this
> problem, but
> it needs to be fixed in any case. If you run unsafe threaded
> code, all
> bets are off.
>
> I would start with investigating if the view you try to update here
> really is the same view instance as in your nib file. Do something
> like this in both your "-awakeFromNib" and from your animation code:
>
> 	NSLog(@"View: %p", theView);
>
>
> j o a r
>
>

_______________________________________________

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

References: 
 >Custom NSView not redrawing (From: Steven E Barnes <email@hidden>)

  • Prev by Date: Re: Using C99 with cocoa
  • Next by Date: Re: Dir of app
  • Previous by thread: Custom NSView not redrawing
  • Next by thread: NSOutlineView or NSTreeController flat list
  • Index(es):
    • Date
    • Thread