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 11:15:13 -0500
No, I only expect to have one instance of my custom view.
Not sure why I'm getting 3 instead of one.
On Mar 11, 2007, at 10:43 AM, Erik Buck wrote:
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
So, -awakeFromNib is being called for three separate instances. Is
that what you expect ?
2007-03-10 20:58:39.242 SoundTemplate05[1629] needs display: 0x39d380
-setNeedsDisplay is only being called for one of the three
instances. Is that what you expect ? It it the correct instance ?
Build a simple application that contains a single custom view
instance that just draws a random colored background. e.g.
@implementation TestView
- (void)drawRect:(NSRect)aRect
{
float whiteIntensity = (float)(random() % 255) / 255.0f;
[[NSColor colorWithDeviceWhite: whiteIntensity alpha:1.0f] set];
NSRectFill(aRect);
}
- (IBAction)buttonWasPushed:(id)sender
{
[self setNeedsDisplay:YES];
}
@end
Does the application correctly display your custom view ?
Connect a button's action to your custom view's -buttonWasPushed:.
Does the view redraw every time you press the button ?
I will send you a working project if you ask. However, I suspect
that if you invest the time to build some simple examples using
first principles, you will better understand the basic operation of
the tools you are using. You can avoid the long series of mailing
list questions in which you ask us to guess what you might have
done wrong.
_______________________________________________
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