• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Need help with setNeedsDisplay - Another Update
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: Need help with setNeedsDisplay - Another Update (From: Erik Buck <email@hidden>)

  • Prev by Date: Re: Reloading a window from NIB
  • Next by Date: Ironcoder V
  • Previous by thread: Re: Need help with setNeedsDisplay - Another Update
  • Next by thread: init vs awakefromnib
  • Index(es):
    • Date
    • Thread