• 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: setAutoresizingMask from code
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setAutoresizingMask from code


  • Subject: Re: setAutoresizingMask from code
  • From: Quincey Morris <email@hidden>
  • Date: Sat, 2 Feb 2008 20:04:07 -0800


On Feb 2, 2008, at 03:27, Aby wrote:

Hi,
I have created one controller for my window which is a subclass of
NSWindowController

and added one button to the window and added the following code to the
Action event.

NSBox *newBox = [[NSBox alloc] initWithFrame:NSMakeRect(10.0f, 10.0f, 200.0f,
200.0f)];


[newBox setBoxType:NSBoxPrimary];


[myBox setAutoresizingMask: NSViewHeightSizable | NSViewWidthSizable ];


[[[self window] contentView] addSubview:newBox];

this will add the box to the content view of the window. but not he
autoresizing mask.

but if I set the auto resizing from the IB for any control on the Window say
for this button then the above code works fine.


How to set the resize state on from code.

I think you're also going to need:

	[[newBox superview] setAutoresizesSubviews: YES];

IIRC, IB does this for you for free, if you put an auto-resizable subview into a view.
_______________________________________________


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: 
 >setAutoresizingMask from code (From: Aby <email@hidden>)

  • Prev by Date: Re: Programmatically connecting outlets
  • Next by Date: Re: [Moderator] Re: MacBook Air multitouch trackpad API
  • Previous by thread: Re: setAutoresizingMask from code
  • Next by thread: Sparkle frameworks error linking on Release
  • Index(es):
    • Date
    • Thread