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 15:40:48 -0400
On 9/10/07, H M <email@hidden> wrote:
> > -display forces the view to redraw itself immediately.
>
> meaning it should call the drawRect method, right? but that method
> does not get called when i move a slider. it is only called when i
> change the size of the window and thereby the size of the view.
It depends. Sorry, but there's simply not enough detail to give you
much more than that.
> > 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.
>
> I fail to see what difference the code in the drawRect method can
> make if it isn't even called...
Actually, you said:
> when I change the size of the window, drawRect: is called
Then you said:
> I've tried [self
> setNeedsDisplay], but that didn't work. I tried [self display], but
> that didn't work either. so I tried both, but the view still refuses
> to update when i move a slider.
Now that I know you meant -drawRect: *is not* called when your
action methods are called, I know that the problem is probably not
within -drawRect: ... you need to be *specific*. Also, that you 'fail
to see' the relevance of something is itself irrelevant. If you knew
what you were missing, you wouldn't be missing it, right? Right.
So ... assuming:
1: Your action methods are in the same NSView subclass as your
-drawRect: method
2: Everything is wired up properly in Interface Builder (outlets /
actions are connected ... and double-checked)
3: Your action methods are in fact being called (not just -drawRect:)
4: You're receiving no errors in your run log
Then:
1: "self" should definitely refer to the view, so calling -display
should definitely trigger a re-draw
2: The action methods should be changing the appropriate values and
triggering a redraw which will use those new values
3: Even if things are not updated immediately as you drag, they
should at least be updated when you've finished dragging the slider,
so everything should work wonderfully.
So it appears you're missing something fundamental in your setup.
Without more information (POST. YOUR. CODE.) it's hard to tell you
what's wrong. I realize it can be difficult in a large or proprietary
project (ISOLATE THE PROBLEM AND SHARE THE ISOLATED TEST PROJECT) but
hey, you're asking the public for help so the legwork and make it easy
for us.
--
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