Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Bulk] Re: Custom NSView not redrawing



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

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



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.