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:<joar...>]
    > 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
    >
    >
previous month december 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
Go to today