Re: Redrawing in a custom NSView.
Re: Redrawing in a custom NSView.
- Subject: Re: Redrawing in a custom NSView.
- From: "Manuel C." <email@hidden>
- Date: Thu, 25 Jan 2007 00:17:59 -0600
El 21/01/2007, a las 07:05 AM, j o a r escribió:
In the variable outline view you'll find "self" that you can expand
to show the ivars.
Ok. I make numeroDeLados an ivar, and add a "-awakeFromNib:" method
for init it, and all works fine at this point. Thanks!
Now.
So, this is basically a trigging problem. Now, I can think of two
reasons why "-setNeedsDisplay:" would fail:
1) You're calling it from inside "-drawRect:", or
No, I never call "-setNeedsDisplay:" inside of "-drawRect:".
2) You're blocking the run-loop. Pooled drawing updates is done at
the end of the current event.
Add log statements to verify that things happen in the order that
you expect.
when I clik a "Draw" button I call a IBAction method "- (IBAction)
dibujar:(id)sender", under my controller class, this method retrieve
the value of my NSTextField, and calls "-dibujar:" under Ccoa2 class.
Viewing many examples, I delete my controller class (instance and
files) and make "-(IBAction)dibujar:" a method of "Cocoa2" class,
Here only retrieve the value of the NSTextField, and pass it to
"numeroDeLados" and I call "-setNeedsDisplay:", and Surprise!. the
fancy shape is redraw it every time that I change the value.
Works!
What is the problem with the firsts implementation (with a controller
class)?
Manuel C.
http://mac-manuelito.blogspot.com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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