• 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
Problem assigning NSView bounds from subview.bounds
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem assigning NSView bounds from subview.bounds


  • Subject: Problem assigning NSView bounds from subview.bounds
  • From: Michael Crawford <email@hidden>
  • Date: Mon, 13 Feb 2012 10:02:09 -0500

I'm trying to have a superview resize itself to match the bounds of a subview when the subview is added.  When I do, the superview bounds become NaN.

Why would this:

- (void)didAddSubview:(NSView *)view
{
    // resize to match bounds of given subview
    NSLog(@"%@ = %@, %@ = %@", self, NSStringFromRect([self bounds]), view, NSStringFromRect([view bounds]));
    [self setBounds:[view bounds]];
    NSLog(@"%@ = %@, %@ = %@", self, NSStringFromRect([self bounds]), view, NSStringFromRect([view bounds]));
}

result in this?

2012-02-13 09:48:03.637 LSSettingsBar[3797:707] <MCView: 0x100184ba0> = {{0, 0}, {0, 0}}, <NSView: 0x100189340> = {{0, 0}, {216, 216}}
2012-02-13 09:48:03.637 LSSettingsBar[3797:707] <MCView: 0x100184ba0> = {{nan, nan}, {nan, nan}}, <NSView: 0x100189340> = {{0, 0}, {216, 216}}

-Michael
_______________________________________________

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


  • Follow-Ups:
    • Re: Problem assigning NSView bounds from subview.bounds
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Re: copy & isEqual nightmares
  • Next by Date: Re: Playing Music in Objective C
  • Previous by thread: Re: iOS icons question
  • Next by thread: Re: Problem assigning NSView bounds from subview.bounds
  • Index(es):
    • Date
    • Thread