Re: custom view won't update
Re: custom view won't update
- Subject: Re: custom view won't update
- From: Shawn Erickson <email@hidden>
- Date: Mon, 10 Sep 2007 19:48:09 -0700
On Sep 10, 2007, at 11:32 AM, H M wrote:
On 10. Sep 2007, at 19:09, I. Savant wrote:
My custom class has 3 action methods, one for each slider. yes, they
get called, and the variables are set. after that, [self
setNeedsDisplay:YES] and [self display] are executed, but they don't
have any effect.
There is not enough information to give you much help. Post your
code.
ok, here is one of the action methods. the other 2 are exactly the
same, except they are assigned to the other 2 sliders, and the name
of the variable is different. all 3 variables are declared as
double in the top of the implementation file.
- (IBAction)setDec:(id)sender {
viewDec = (double) [sender floatValue]; // this line works
perfectly
[self setNeedsDisplay:YES]; //this one is executed but has no
visible effect at all.
[self display]; //same here
}
It seems a little strange that an NSView subclass has IBActions/
IBOutlets... yet the above code seems to imply that.
Can you please outline which classes contain which methods and which
is the NSView subclass? Also can you describe how they are
connected / instantiated in the nib?
Given what you have posted so far I believe you are not sending the
setNeedsDisplay: message to an instance of your view that is actually
in the view hierarchy of your window but one that is either
instantiated off by itself in the nib or instantiated in code (and
not the one in the view hierarchy).
Using the debugger to note the address of the instances involved
would help detect this type of issue as would using logging (for
example NSLog(@"%s - %p", __FUNCTION__, self);)
-Shawn
_______________________________________________
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