Re: loaded subview not expanding correctly.
Re: loaded subview not expanding correctly.
- Subject: Re: loaded subview not expanding correctly.
- From: Philip Bridson <email@hidden>
- Date: Fri, 25 Jan 2008 21:02:40 -0800
Hi there, I have recently experienced the same sort of problem. The solution I came up with is below, I hope it helps. Please note, it only works if you are using IB to create your subviews.
Firstly you need to find out what the Maximum space is that is available as a subview.
I did this by simply adding a subview to my customView and expanding it until I hit the blue cocoa boundaries. Use the inspector to find out the size then set your actual subview to this size. Remove the test subview from your custom view before saving it.
Once you have set up your subview with the correct size that is required, use [superView addSubView:subview] to load it and [subview removeFromSuperView] to remove it.
This works perfectly for me so I hope it helps you.
Phil.
On Saturday, January 26, 2008, at 04:21AM, "Chris Schmitt" <email@hidden> wrote:
>I have a window with a custom view in it. I want to load subviews
>into the custom view depending on the action of the window. So far I
>have this code from the "View Programming Guide for Cocoa":
>
>[[theView superview] setNeedsDisplayInRect:[theView frame]];
>[theView setFrame:newFrame];
>[theView setNeedsDisplay:YES];
>
>My view is loading fine, but my problem is in it's position. The
>subview is loading into the center of the superview and clipping the
>right side. I have set the autosizers to take up the whole panel and
>when I resize the window the subview does look like it is resizing,
>but there is still a gap on the left hand side.
>
>Any tutorials or advice would be very helpful.
>
>Thanks in advance
>
>
>_______________________________________________
>
>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
>
>
_______________________________________________
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