Re: custom view won't update
Re: custom view won't update
- Subject: Re: custom view won't update
- From: "I. Savant" <email@hidden>
- Date: Mon, 10 Sep 2007 14:40:21 -0400
> 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
> }
You need to read the documentation for those two methods.
-setNeedsDisplay: flags the view as needing display but does not
immediately do so (for optimization purposes). -display forces the
view to redraw itself immediately.
If you want changes to happen while moving the slider, you need to
check the slider's "Continuously send action while sliding" checkbox
in Interface Builder.
Regarding necessary code, what's in your view's -drawRect: method?
"Post your code" means you need to post all the relevant code. The
contents of your custom -drawRect: method is certainly that.
> the header file declares the outlets in the following format:
>
> IBOutlet NSSlider *DecSlider;
>
>
> erm, do I NEED those outlets? or is it enough to call [sender
> floatValue]? gotta try that...
You don't need them unless you want to message them. The "sender"
argument refers to the sender of the message (in this case, your
slider), so it will be fine in this case.
--
I.S.
_______________________________________________
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