Re: Need help with setNeedsDisplay - Another Update
Re: Need help with setNeedsDisplay - Another Update
- Subject: Re: Need help with setNeedsDisplay - Another Update
- From: Yevgeniy Goldberg <email@hidden>
- Date: Sun, 11 Mar 2007 10:39:03 -0500
I did not intend on having 3 instances of my custom view. I needed
just one.
Not sure how to figure out where the other 2 instances come from.
On Mar 11, 2007, at 10:01 AM, Andy Lee wrote:
On Mar 10, 2007, at 9:57 PM, Yevgeniy Goldberg wrote:
I was not deleting the entire custom view, only it's instance in
the nib file.
When this instance is present in the nib file, drawRect will work,
but only after window is resized.
It sounds like you're saying you didn't delete the custom view
*class* from your project (i.e., you were still compiling the .h
and .m files for it). You just deleted the *instance* that was in
the nib file. Well, naturally if your application never creates an
instance of a class, none of the class's instance methods (such as
drawRect:) will ever be called.
Here is the output of one app run:
2007-03-10 20:53:18.456 SoundTemplate05[1299] awoke 0x3982e0
2007-03-10 20:53:18.456 SoundTemplate05[1299] awoke 0x39d380
2007-03-10 20:53:18.456 SoundTemplate05[1299] awoke 0x39cd70
As you have suggested, I've put the NSLog into a blank
awakeFromNib of my custom view class
This output shows that your nib file has three instances of your
custom view. Is this what you intended? I thought you only had
one instance.
I'm not sure how I could use the po command in the debuger since I
do not have this custom view defined as IBOutlet
The purpose of the po suggestion was to look at the object you were
sending the setNeedsDisplay: message to. Since you are sending it
to self, you could say "po self". Or, to see the memory address of
self, you could say "p self".
--Andy
On Mar 10, 2007, at 8:43 PM, Andy Lee wrote:
On Mar 10, 2007, at 5:24 PM, Yevgeniy Goldberg wrote:
Getting rid of an instance of my custom view in the nib file did
not help.
In fact, after I deleted that instance from the nib nothing was
redrawing even after the window resize.
I am confused about the structure of your app. How could
deleting the custom view cause the custom view to correctly
redraw, if it's no longer there?
In any case, I'm sure you/we will get to the bottom of this!
You're *positive* you are calling setNeedsDisplay: where you
think you are? If you put an NSLog before and after it, you see
the log output? (Or you could use a breakpoint as Nick suggested.)
And are you positive drawRect: is *not* getting called? Can you
confirm this with a breakpoint or NSLog?
And you're positive the instance of the view that you're sending
setNeedsDisplay: to is the right instance? You could add an
awakeFromNib method to the custom view that just does this:
NSLog(@"awoke 0x%x", self);
And just before you call [self setNeedsDisplay:] you could do this:
NSLog(@"needs display: 0x%x", self);
And make sure the printed addresses are the same.
As a very blunt, "dumb" test, what if you add a button (or change
the action of an existing one) such that the target is the custom
view and *all* the action does is setNeedsDisplay:YES? Surely
drawRect: should get called then? (You'll need a breakpoint or
NSLog to confirm this, because no data will have changed.)
--Andy
_______________________________________________
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:
40mac.com
This email sent to email@hidden
_______________________________________________
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
_______________________________________________
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
_______________________________________________
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