• 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: Noob question: Weirdness getting the bounds of an NSView...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Noob question: Weirdness getting the bounds of an NSView...


  • Subject: Re: Noob question: Weirdness getting the bounds of an NSView...
  • From: Quincey Morris <email@hidden>
  • Date: Tue, 24 Mar 2009 14:55:07 -0700

On Mar 24, 2009, at 10:46, Jim Anderson wrote:

The weird thing is, when drawRect gets called, [self bounds] returns a
reasonable looking bounding rectangle. When doSomeStuff gets called, [self
bounds] returns {0, 0, 0.0, 0.0}. The extra weird thing is, if doSomeStuff
is called *after* drawRect gets fired, myBounds is {0, 0, 0.0, 0.0},
*despite* it being set to something reasonable in drawRect.


Any ideas what's going on here?

The usual cause of this sort of thing is accidentally creating two different view instances. If you put an instance of your custom subview into your NIB file using Interface Builder, you should not also create an instance of your view programmatically.


When you see the different values of myBounds in the two methods, are the values of 'self' different? I'd guess they are.


_______________________________________________

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


References: 
 >Noob question: Weirdness getting the bounds of an NSView... (From: Jim Anderson <email@hidden>)

  • Prev by Date: [Q] Convert PixMapHandle to NSBitmapImageRep
  • Next by Date: Re: [Q] Convert PixMapHandle to NSBitmapImageRep
  • Previous by thread: Re: Noob question: Weirdness getting the bounds of an NSView...
  • Next by thread: Control over position of tooltip for a NSView
  • Index(es):
    • Date
    • Thread